+ Reply to Thread
Results 1 to 4 of 4

using WScript.CreateObject("Wscript.Shell

  1. #1
    John Keith
    Guest

    using WScript.CreateObject("Wscript.Shell

    Sub Test()
    Dim objShell As Object
    Set objShell = WScript.CreateObject("Wscript.Shell")
    Wait = True
    objShell.Run "c:\FSOTest\FTP02.BAT", 1, Wait
    End sub

    FTP02.BAT points to a script file that will "get" a file from an IBM
    mainframe. (the FTP is tested and works as a stand-alone)

    The "Set" statement gets a runtime error 424 "Object required"

    I have added References for Microsoft VBScript Regular Expressions 1.0 and 5.5
    pointing to C"\WINNT\System32\vbscript.dll\2 and ...\3 respectively (perhaps
    there is a different reference that is needed?)

    How do I make this code work from VBA?

    I plan on making this run from an Open event to always refresh the data from
    an external source before the spreadsheet data is shown.


    --
    Regards,
    John

  2. #2
    Dave Patrick
    Guest

    Re: using WScript.CreateObject("Wscript.Shell

    Change this line;
    Set objShell = WScript.CreateObject("Wscript.Shell")
    to
    Set objShell = CreateObject("Wscript.Shell")


    --
    Regards,

    Dave Patrick ....Please no email replies - reply in newsgroup.
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    http://www.microsoft.com/protect

    "John Keith" wrote:
    | Sub Test()
    | Dim objShell As Object
    | Set objShell = WScript.CreateObject("Wscript.Shell")
    | Wait = True
    | objShell.Run "c:\FSOTest\FTP02.BAT", 1, Wait
    | End sub
    |
    | FTP02.BAT points to a script file that will "get" a file from an IBM
    | mainframe. (the FTP is tested and works as a stand-alone)
    |
    | The "Set" statement gets a runtime error 424 "Object required"
    |
    | I have added References for Microsoft VBScript Regular Expressions 1.0 and
    5.5
    | pointing to C"\WINNT\System32\vbscript.dll\2 and ...\3 respectively
    (perhaps
    | there is a different reference that is needed?)
    |
    | How do I make this code work from VBA?
    |
    | I plan on making this run from an Open event to always refresh the data
    from
    | an external source before the spreadsheet data is shown.
    |
    |
    | --
    | Regards,
    | John



  3. #3
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello John

    you may try

    Sub Test()
    Dim objShell As Object
    Set objShell = CreateObject("Wscript.Shell")
    objShell.Run "c:\FSOTest\FTP02.BAT", 1, True
    End Sub


    else you need the Windows Script Host Object Model reference

    Sub Test2()
    Dim objShell As WshShell
    Set objShell = CreateObject("Wscript.Shell")
    objShell.Run "c:\FSOTest\FTP02.BAT", 1, True
    End Sub


    Regards ,
    michel

  4. #4
    Forum Contributor
    Join Date
    12-11-2004
    MS-Off Ver
    2007
    Posts
    137
    Hello Dave

    sorry , i didn't see your anwser

    regards ,
    michel

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1