Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have inherited a piece of VBA which runs inside Excel and to which I have to add Zoom All. Here is the code, but the Zoom All part doesn't.
Sub AutocadSaveDWG()
On Error GoTo ASDWG_Err:
Dim Application As AcadApplication
Dim Document As AcadDocument
Dim filepath As String, sDate As String, sTime As String
Dim saveFolder, Filename As String
Set Application = GetObject(, "AutoCAD.Application")
Set Document = Application.ActiveDocument
saveFolder = "C:\DisegniSviluppati\"
sDate = GetFileNameString(Date)
sTime = GetFileNameString(Time)
' This filename takes the type of machine and adds the date
Filename = Worksheets("DEVES_TABLE").Range("D10") & "_" & sDate & "_(" & sTime & ")"
filepath = saveFolder & Filename
' Application.ZoomExtents
Application.ZoomAll
Document.SaveAs filepath
Exit Sub
ASDWG_Err:
ShowErrorMsgBox ("AutocadSaveDWG")
End Sub
Neither ZoomAll nor ZoomExtents works. What have I missed?
Solved! Go to Solution.