View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] sydneyluu@yahoo.com is offline
external usenet poster
 
Posts: 2
Default 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