Rıdvan Çetin
Rıdvan Çetin

Reputation: 183

Msgbox changing button caption for vbs

Option Explicit
Const conForReading = 1
Dim objFSO, objReadFile, objFile, contents, result, shell
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\read.txt") 

If objFile.Size  Then 
Set objReadFile = objFSO.OpenTextFile("C:\read.txt", 1, False)
contents = objReadFile.ReadAll
result = MsgBox ("text2" & contents & "text1",vbYesNo+vbExclamation,"TITLE")
Select Case result
Case vbYes
Set shell = wscript.CreateObject("Shell.Application")
shell.Open "D:\folder"
Case vbNo
End Select
objReadFile.close

Else 
End If  

Set objFSO = Nothing 
Set objReadFile = Nothing 
WScript.Quit() 

I have this vbs file, and I want to change vbYesNo captions, for yes Open Folder and for no Exit. But I don't know how to do it, and I couldn't find a way to do this. Maybe I am missing an easy thing because I am new to programming. but I would like to learn that.

Upvotes: 0

Views: 6257

Answers (1)

Nathan Rice
Nathan Rice

Reputation: 3111

It's not possible. There is no option for that with the MessageBox function. Your options are:

OK
OK, Cancel
Abort, Retry, Ignore
Yes, No, Cancel
Yes, No
Retry, Cancel

Reference: http://msdn.microsoft.com/en-us/library/sfw6660x(v=vs.84).aspx

Upvotes: 2

Related Questions