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 TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenDoc call fails!

Status
Not open for further replies.

jwalz

Computer
Joined
Apr 22, 2003
Messages
10
Location
US
I am trying to write a macro that will go through all of my drawing files and extract the BOM information. When I execute the OpenDoc method the drawing opens, but I get the following error at the end of the method line execution: Run-time error '91': Object variable or With block variable not set and the call fails. I hope that someone can point out what I am doing wrong. Here is my code:
....
Set swApp = CreateObject("SldWorks.Application")
swModel = swApp.OpenDoc6(infile, swDocDRAWING, 0, "", swError, swWarn)
....
Where infile is the complete path and file name of the drawing file that I want to open.

Thanks!
Janet
 
simple VB omission. You need the "Set" keyword to set an object.

Set swModel = swApp.OpenDoc6(infile, swDocDRAWING, 0, "", swError, swWarn)

[bat]On justice and on friendship, there is no price, but there are established credit limits.[bat]
 
Thank you so much. That did the trick!

Janet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top