Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 - Excel Help Please

Status
Not open for further replies.

vbpadawan

Programmer
Oct 8, 2002
28
US
I am attempting to open an excel worksheet and update the links using VB6. For some reason the Excel.Application is not being created and I receive the following error:
<Object variable or With block variable not set>

Below is my code:

Private Sub UpdateLinks()
Dim ExAp As Excel.Application
Dim ExWb As Excel.Workbook

Set ExAp = New Excel.Application

ExWb.Open &quot;C:\Projects\filename.xls&quot;, 3, True

ExWb.RunAutoMacros xlAutoActivate
End Sub
 
Try this:
___
Private Sub UpdateLinks()
Dim ExAp As Excel.Application
Dim ExWb As Excel.Workbook

Set ExAp = New Excel.Application
Set ExWb = ExAp.Workbooks.Open(...)

ExWb.RunAutoMacros xlAutoActivate
End Sub
 
for more info

faq222-3383

Please pardon the grammar.
Not good in english.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top