- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i have the below code with a button that exports a drawing to dwf in one click, works great in 2014 however just got 2020 and the program is catching in the red text line.........any ideas would be great as this command is quick and handy, thank you
Sub dwfmaker()
MsgBox "DWF-filer creating", vbInformation
Dim invApp As Inventor.Application
Set invApp = ThisApplication
' invApp.SilentOperation = True
Dim idwDoc As Inventor.DrawingDocument
Set idwDoc = invApp.ActiveDocument
Dim dwfFile As String
Dim laserdir As String
Dim FirstLet As Variant
Dim Output As Integer
Dim MyCheck As String
FirstLet = Left(idwDoc.DisplayName, 1)
MyCheck = IsNumeric(FirstLet)
If MyCheck = True Then
laserdir = "x:\" + "Numbered" + "\"
Else
laserdir = "x:\" + FirstLet + "\"
End If
dwfFile = laserdir + idwDoc.DisplayName + ".dwf"
'determine of dwf already exists
Dim FilePath As String
FilePath = ""
FilePath = Dir(dwfFile)
If FilePath = "" Then
'MsgBox "File doesn't exist"
Output = MsgBox("File Doesn't Exist", vbOKCancel)
'If Output = 1 Then
With invApp.CommandManager
Call .PostPrivateEvent(kFileNameEvent, dwfFile)
Call .StartCommand(kFileSaveCopyAsCommand)
End With
Set idwDoc = Nothing
Else
Output = MsgBox("File Exists", vbOKCancel)
Output = 2
End If
If Output = 2 Then
Output = MsgBox("Do You Want To Overwrite Existing File?", vbYesNoCancel)
End If
If Output = 6 Then
With invApp.CommandManager
Call .PostPrivateEvent(kFileNameEvent, dwfFile)
Call .StartCommand(kFileSaveCopyAsCommand)
End With
ElseIf Output = 7 Then
Else
Output = 2
End If
End Sub
Solved! Go to Solution.