12-16-2020
08:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
12-16-2020
08:19 AM
See if this edit works for you instead:
(I replaced your 'With' blocks with a simple SaveAs() method.)
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)
Call idwDoc.SaveAs(dwfFile, True) 'True = SaveCopyAs
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
Call idwDoc.SaveAs(dwfFile, True) 'True = SaveCopyAs
ElseIf Output = 7 Then
Else
Output = 2
End If
End SubIf this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE'
.
If you have time, please... Vote For My IDEAS
and Explore My CONTRIBUTIONS
Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum
Wesley Crihfield
(Not an Autodesk Employee)