ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   form not opening when started from command line (https://www.excelbanter.com/excel-programming/443090-form-not-opening-when-started-command-line.html)

Bill Grigg

form not opening when started from command line
 
All,

After searching around I guess that I now can start my Excel app from a
batch file. However, I also need to open a form automatically also. Here is
the code:

Private Sub Workbook_Open()
Dim cmdLine As String
Dim lst() As String
Dim ky As String

Set App = Application
CreateMenus
' Check to see if this is a "scheduled task"
'
cmdLine = GetCommLine (code is elsewhere but it does work)
If Len(cmdLine) = 0 Then Exit Sub
If Not InStr(cmdLine, "/") Then Exit Sub
' Get rid of alerts
'
App.DisplayAlerts = False
' Check out the passed arguments
'
lst = Split(cmdLine, "/")
' Assume we always want the AutoRelease form for now
'
frmRelease.Show (nothing happens)


The form "frmRelease" does not open. Any suggestions?

TIA,

Bill

Bill Grigg

form not opening when started from command line
 
oops there was a bug in the code - If Not InStr(cmdLine, "/") Then Exit Sub

does not work. I am forever forgetting that "..Not InStr(..." does not do
what it reads as. The form opens just fine.

Sorry about that,

Bill

"Bill Grigg" wrote:

All,

After searching around I guess that I now can start my Excel app from a
batch file. However, I also need to open a form automatically also. Here is
the code:

Private Sub Workbook_Open()
Dim cmdLine As String
Dim lst() As String
Dim ky As String

Set App = Application
CreateMenus
' Check to see if this is a "scheduled task"
'
cmdLine = GetCommLine (code is elsewhere but it does work)
If Len(cmdLine) = 0 Then Exit Sub
If Not InStr(cmdLine, "/") Then Exit Sub
' Get rid of alerts
'
App.DisplayAlerts = False
' Check out the passed arguments
'
lst = Split(cmdLine, "/")
' Assume we always want the AutoRelease form for now
'
frmRelease.Show (nothing happens)


The form "frmRelease" does not open. Any suggestions?

TIA,

Bill



All times are GMT +1. The time now is 09:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com