Randy Berg
January 10th, 2000, 11:53 AM
This excel VBA procedure runs alright in Win98 but not WinNT. The procedure opens and closes an autocad application and has 2 message boxes for debugging. How do I make it work in WinNT?
Thank you for your help.
Dim otherApp As Object 'otherApp is autocad R14 application
Sub get_acad()
Dim fname As Variant
fname = Excel.Application.GetOpenFilename("Drawing (*.dwg),*.dwg", , "Open AutoCAD drawing to extract BOM text.")
If fname = False Then Exit Sub
MsgBox "fname= " + fname, , "Selected Filename" 'debug line
On Error Resume Next
Set otherApp = GetObject(fname) ' ***automation type errors occur at this line in WinNT***
If Err Then
MsgBox "Error description: " + Err.Description, , "Error finding AutoCAD" 'debug line
Exit Sub
End If
Err.Clear
otherApp.Application.Quit
Set otherApp = Nothing
End Sub
Thank you for your help.
Dim otherApp As Object 'otherApp is autocad R14 application
Sub get_acad()
Dim fname As Variant
fname = Excel.Application.GetOpenFilename("Drawing (*.dwg),*.dwg", , "Open AutoCAD drawing to extract BOM text.")
If fname = False Then Exit Sub
MsgBox "fname= " + fname, , "Selected Filename" 'debug line
On Error Resume Next
Set otherApp = GetObject(fname) ' ***automation type errors occur at this line in WinNT***
If Err Then
MsgBox "Error description: " + Err.Description, , "Error finding AutoCAD" 'debug line
Exit Sub
End If
Err.Clear
otherApp.Application.Quit
Set otherApp = Nothing
End Sub