Again, the mystikal magic of VB is eluding my presence (I swear there's some little gremlin in my machine laughing at me). Anyway, I coded applications to open and run, and I was using a halfa$$ counter to make the application wait before executing the next line(I know, "bad programmer, bad!"
.
This was making sure the first application was open and ready to before giving a set of commands from a prompt.
Below is my code. Does anybody have a way to make the program wait? Also, closing shells seems to be out of my grasp at the moment.
***BEGIN CODE***
Function ScriptCtcl3_()
Dim XL As Excel.Application
Dim Wkb As Workbook
Dim strCmdLine As String
Dim strEmulator As String
'Set Parameters for command lines and shells
'The switch "/K" can be replaced with "/C" to automatically
'close the opened program when the program has executed.
strCmdLine = "cmd.exe /C commandline to run"
strEmulator = "pcsws session.ws /K"
Set XL = CreateObject("Excel.Application"
With XL
.Visible = True
Set Wkb = .Workbooks.Open(Filename:="v:\cms\access\agent\import\l3current.xls", UpdateLinks:=True)
End With
'The following 3 lines allow time for spreadsheet to open
'and update
Make next command wait a few seconds
Do While (x < 5500000)
x = x + 1.5
Loop
Call Shell(strEmulator, vbNormalFocus)
Make next command wait a few seconds so the above shell can open
Do While (x < 5500000)
x = x + 1
Loop
Call Shell(strCmdLine, vbNormalFocus)
I would like to be able to close everything after the emulator script has finished running
End Function Jay![[infinity] [infinity] [infinity]](/data/assets/smilies/infinity.gif)
"If the words up and down were reversed, would you trip and fall or trip and fly?"
This was making sure the first application was open and ready to before giving a set of commands from a prompt.
Below is my code. Does anybody have a way to make the program wait? Also, closing shells seems to be out of my grasp at the moment.
***BEGIN CODE***
Function ScriptCtcl3_()
Dim XL As Excel.Application
Dim Wkb As Workbook
Dim strCmdLine As String
Dim strEmulator As String
'Set Parameters for command lines and shells
'The switch "/K" can be replaced with "/C" to automatically
'close the opened program when the program has executed.
strCmdLine = "cmd.exe /C commandline to run"
strEmulator = "pcsws session.ws /K"
Set XL = CreateObject("Excel.Application"
With XL
.Visible = True
Set Wkb = .Workbooks.Open(Filename:="v:\cms\access\agent\import\l3current.xls", UpdateLinks:=True)
End With
'The following 3 lines allow time for spreadsheet to open
'and update
Make next command wait a few seconds
Do While (x < 5500000)
x = x + 1.5
Loop
Call Shell(strEmulator, vbNormalFocus)
Make next command wait a few seconds so the above shell can open
Do While (x < 5500000)
x = x + 1
Loop
Call Shell(strCmdLine, vbNormalFocus)
I would like to be able to close everything after the emulator script has finished running
End Function Jay
![[infinity] [infinity] [infinity]](/data/assets/smilies/infinity.gif)
"If the words up and down were reversed, would you trip and fall or trip and fly?"