Message 1 of 2
How can you execute an inventor sub from excel

Not applicable
10-02-2008
07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a excel macro to open inventor for a list of files in excell
*******
Sub Main()
Dim oInvApp As Inventor.Application
'Launch Inventor
Set oInvApp = CreateObject("Inventor.Application")
oInvApp.Visible = True
oInvApp.SilentOperation = True
'Set Startup options.
oInvApp.GeneralOptions.ShowStartupDialog = False
Dim oDoc As Inventor.DrawingDocument
counter = Application.ActiveWorkbook.ActiveSheet.Cells(1, 7).Value
For i = 1 To counter
nPath = Application.ActiveWorkbook.ActiveSheet.Cells(i + 1, 6).Value
m = Application.ActiveWorkbook.ActiveSheet.Cells(i + 1, 2).Value
oName = "C:\_Vault Workspace\Designs\" & nPath & "\" & m & ".idw"
Set oDoc = oInvApp.Documents.Open(oName)
fNAME = oDoc.FullFileName
'fNAME = Left(fNAME, Len(fNAME) - 3) & "dwg"
Dim iPath As Integer
Dim sPath As String
iPath = InStrRev(fNAME, "\")
sPath = Left(fNAME, iPath)
Next i
'Call createDWG(oDoc.Parent, dwgAddIn, fNAME, sPath)
'oDoc.Close SaveChanges = False
'oInvApp.Quit
Set oInvApp = Nothing
End Sub
*******
How do i run a inventor subroutine? i tried putting Call MyMacro() but it didnt work
Thanks
*******
Sub Main()
Dim oInvApp As Inventor.Application
'Launch Inventor
Set oInvApp = CreateObject("Inventor.Application")
oInvApp.Visible = True
oInvApp.SilentOperation = True
'Set Startup options.
oInvApp.GeneralOptions.ShowStartupDialog = False
Dim oDoc As Inventor.DrawingDocument
counter = Application.ActiveWorkbook.ActiveSheet.Cells(1, 7).Value
For i = 1 To counter
nPath = Application.ActiveWorkbook.ActiveSheet.Cells(i + 1, 6).Value
m = Application.ActiveWorkbook.ActiveSheet.Cells(i + 1, 2).Value
oName = "C:\_Vault Workspace\Designs\" & nPath & "\" & m & ".idw"
Set oDoc = oInvApp.Documents.Open(oName)
fNAME = oDoc.FullFileName
'fNAME = Left(fNAME, Len(fNAME) - 3) & "dwg"
Dim iPath As Integer
Dim sPath As String
iPath = InStrRev(fNAME, "\")
sPath = Left(fNAME, iPath)
Next i
'Call createDWG(oDoc.Parent, dwgAddIn, fNAME, sPath)
'oDoc.Close SaveChanges = False
'oInvApp.Quit
Set oInvApp = Nothing
End Sub
*******
How do i run a inventor subroutine? i tried putting Call MyMacro() but it didnt work
Thanks