CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 1999
    Posts
    1

    Loading Vb commands from text file

    I want to call vb commands such as msgbox and inputbox from an ordinary text file. Is this possible and what is the syntax for running these commands when they have been put into a string.



  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Loading Vb commands from text file

    this is a sample for an interpreter:

    add the Microsoft Script Control to the Components of your app

    name it "s" (for lazy typers)

    add a button
    add the following code

    private Sub Command1_Click()
    Dim hFile as Integer
    hFile = FreeFile
    Dim strLine as string
    Open "c:\test.txt" for input as #hFile
    Do While Not EOF(hFile)
    Line input #hFile, strLine
    s.ExecuteStatement strLine
    Loop
    Close (hFile)
    End Sub




    this is my sample test.txt

    msgbox "hello.world"
    msgbox "greetings from the script control"

    tested in NT 4 and VB 6


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured