View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
John Coleman John Coleman is offline
external usenet poster
 
Posts: 274
Default Passing SQLPlus script location using Windows Script Host Object Model

On Jan 30, 10:52*am, Scott Spence wrote:
Ok,

So I haz lots of scripts that are generated by a team in my organisation which need to then be processed via SQLPlus

Basically we/me get loads of emails with the script location @Z:/aFolder/aScript.sql;

We then have to process them individually by opening up SQLPlus and pasting the file location in there ;"

I have been looking into a way to automate this via either c# or VBA

I think that the Windows Script Host Object Model option via VBA is a good one

Example:

Option Explicit

Sub SQLPlus(strFilePath)

* * Dim WShell As New WshShell
* * WShell.Run "sqlplus " & strFilePath

End Sub

Sub test()

* * Call ;")

End Sub

Only issue is that I get an error from passing that last file location in the "SP2-0310: unable to open file location "Z:/aFolder/aScript.sql;"

Am I missing a special character or something from this?

I pass the @ sign into the string but its not recognised on the command line??

Any input greatly appreciated, thanks.


Sometimes enclosing paths in strings helps. Maybe you can try

Sub SQLPlus(strFilePath)

Dim WShell As New WshShell
WShell.Run "sqlplus " &
strFilePath & """"
End Sub