ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting "Object Required" Error Message - Need Help !!! (https://www.excelbanter.com/excel-programming/317375-getting-object-required-error-message-need-help.html)

[email protected]

Getting "Object Required" Error Message - Need Help !!!
 
I have an Excel workbook (Automate_WTI.xls) with three sheets - Sheet1,
Sheet2 and Sheet3. I wrote some VBA code under the Auto_Open routine in
the module file so that it will execute automatically when the XLS is
loaded. The code in this routine performs three basic things:

1. Loads an Excel Add-In.
2. Makes calls to this add-in to retrieve data from an external database
over the WAN and populates the Sheets.
3. Sends output to a network printer

Then I wrote a VB6 frontend to call the above Workbook. My goal is to have a
VB wrapper, which loops through a network folder; processes each workbook it finds.
The end result is to setup one single VB EXE in Windows 2000 Task Scheduler
to execute at certain time. Here's the test VB code I have:

Private Sub Command1_Click()


Dim xl As Excel.Application
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet
Dim apppath As String

apppath = App.Path & "\" & "Automate_WTI.xls"

Set xl = New Excel.Application
xl.Visible = True

Set wkb = xl.Workbooks.Open(FileName:=apppath)

wkb.RunAutoMacros xlAutoOpen

'wkb.Save
'wkb.Close
'xl.Quit
'Set wks = Nothing
'Set wkb = Nothing
'Set xl = Nothing

End Sub


The problem I am having is when I invoke the VB EXE, I can see it loads my
workbook but puts me in debug mode with an error on this line in Auto_Open
routine and the error message is "Object Required"

Application.Run "Login", strMyLogin, strMyPasswd <-- stops here in debug mode

The above line makes a call to the Add-In to login to the external database.

Can someone provide some help and explain to me what I need to fix this? My
Excel/VBA skill is limited but good in VB.

Thank you in advance!!!


Sydney Luu


Jim Cone

Getting "Object Required" Error Message - Need Help !!!
 
Sydney,

Try adding the add-in workbook name to the Application.Run call...
( note the exclamation point that separates the workbook name from the sub routine )

Application.Run "MyAddInName.xla!Login, strMyLogin, strMyPasswd"

Regards,
Jim Cone
San Francisco, CA

wrote in message
om...

-snip-

The problem I am having is when I invoke the VB EXE, I can see it loads my
workbook but puts me in debug mode with an error on this line in Auto_Open
routine and the error message is "Object Required"
Application.Run "Login", strMyLogin, strMyPasswd <-- stops here in debug mode
The above line makes a call to the Add-In to login to the external database.
Can someone provide some help and explain to me what I need to fix this? My
Excel/VBA skill is limited but good in VB.
Thank you in advance!!!
Sydney Luu


[email protected]

Getting "Object Required" Error Message - Need Help !!!
 
Thanks for responding. This did not help fix the problem - still get
"Object Required" on that line.


"Jim Cone" wrote in message ...
Sydney,

Try adding the add-in workbook name to the Application.Run call...
( note the exclamation point that separates the workbook name from the sub routine )

Application.Run "MyAddInName.xla!Login, strMyLogin, strMyPasswd"

Regards,
Jim Cone
San Francisco, CA

wrote in message
om...

-snip-

The problem I am having is when I invoke the VB EXE, I can see it loads my
workbook but puts me in debug mode with an error on this line in Auto_Open
routine and the error message is "Object Required"
Application.Run "Login", strMyLogin, strMyPasswd <-- stops here in debug mode
The above line makes a call to the Add-In to login to the external database.
Can someone provide some help and explain to me what I need to fix this? My
Excel/VBA skill is limited but good in VB.
Thank you in advance!!!
Sydney Luu


Chip Pearson

Getting "Object Required" Error Message - Need Help !!!
 
Instead of 'Application', use the application object you created
with the Set New statement. E.g.,

xl.Run ....


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




wrote in message
om...
Thanks for responding. This did not help fix the problem -
still get
"Object Required" on that line.


"Jim Cone" wrote in message
...
Sydney,

Try adding the add-in workbook name to the Application.Run
call...
( note the exclamation point that separates the workbook name
from the sub routine )

Application.Run "MyAddInName.xla!Login, strMyLogin,
strMyPasswd"

Regards,
Jim Cone
San Francisco, CA

wrote in message
om...

-snip-

The problem I am having is when I invoke the VB EXE, I can
see it loads my
workbook but puts me in debug mode with an error on this
line in Auto_Open
routine and the error message is "Object Required"
Application.Run "Login", strMyLogin, strMyPasswd <-- stops
here in debug mode
The above line makes a call to the Add-In to login to the
external database.
Can someone provide some help and explain to me what I need
to fix this? My
Excel/VBA skill is limited but good in VB.
Thank you in advance!!!
Sydney Luu





All times are GMT +1. The time now is 05:41 PM.

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