|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
variable help in vbscript
HI all i'm trying to read a text file then display the results in a msgbox
but i'm havein trouble useing a variable what i'm doing is reading a txt file then i need a variable to put the text into a msg box here is example of what i'm doing i would love some help on this thank you very much Function ReadTextFileTest Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fso, f, Msg Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("test.txt", ForReading) ReadTextFileTest = f.Read(5) End Function msgbox "$f", 1, (f)
Show quote
"sleepy" <sle***@discussions.microsoft.com> wrote in message I'm not sure if this is what you are asking, but try this:news:DFE1173C-6411-4F8B-AD28-009CECDDDA24@microsoft.com... > HI all i'm trying to read a text file then display the results in a msgbox > but i'm havein trouble useing a variable what i'm doing is reading a txt file > then i need a variable to put the text into a msg box here is example of > what i'm doing > i would love some help on this thank you very much > > Function ReadTextFileTest > Const ForReading = 1, ForWriting = 2, ForAppending = 8 > Dim fso, f, Msg > Set fso = CreateObject("Scripting.FileSystemObject") > Set f = fso.OpenTextFile("test.txt", ForReading) > ReadTextFileTest = f.Read(5) > End Function > > msgbox "$f", 1, (f) Dim MyVariable MyVariable = ReadTextFileTest MsgBox MyVariable, vbOKCancel, "Title/Caption" Read the syntax for the MsgBox function: http://msdn.microsoft.com/library/en-us/script56/html/vsfctMsgBox.asp |
|||||||||||||||||||||||