Question : Access 2003: shell command - quest 2

Hi EE,

a) Can I use this vb script codes in VBA?  
b) If (a) yes, what has to be selected under Tools/References
c) If (a) yes, How to modify this code so that can run under VBA?

d)  reason for this post:
======================
   1) I'm having trouble in Access to execute a vba shell command
                       of  a .bat file,
    The .bat file contains a statement to evoke a pgm called Oracle Discoverer.
     Oracle Discoverer comes up for a few seconds then aborts due to a Windows error.

    2) I posted my trouble on an Oracle forum. here, and an expert suggested vbscript.
         http://forums.oracle.com/forums/thread.jspa?forumID=56&threadID=1011893

        I do not know vbscript.
       
         Also, i think of vbscript running independent of an Access form, and i want the user to evoke this pgm
        by an Access button, so unsure if a vbscript approach is what i need. Do you agree?

tx for your ideas and advice, sandra

Dim goShell
Dim msCommand
Set goShell = CreateObject("Wscript.Shell")
msCommand = "C:\oracle\BIToolsHome_1\bin\dis51usr.exe" & _
            "/connect testUser/testPswd@odsp8" & _
            "/opendb SREG.Advisor_CAD_M3" & _
            "/sheet all"
 
Call goShell.Run (msCommand, 1, true)




Dim goShell
Dim msCommand
Set goShell = CreateObject("Wscript.Shell")
msCommand = "C:\oracle\BIToolsHome_1\bin\dis51usr.exe" & _
            "/connect testUser/testPswd@odsp8" & _
            "/opendb SREG.Advisor_CAD_M3" & _
            "/sheet all"
 
Call goShell.Run (msCommand, 1, true)

Answer : Access 2003: shell command - quest 2

You should be able to paste that code directly into a standard VBA module. You shouldn't need to add any refernces, as long as the machine has the necessary libraries/files to create the Wscript.Shell object (and any Windows machine should be able to do that).

Whether your script would run would be dependent on whether your batch file is correctly formed.

For my money, if this is a batch file, then why not just buld the batch file and call it with shell:

Shell "full path to your batch file"
Random Solutions  
 
programming4us programming4us