WblockTo2000.dvb sample code for AutoCADHave you been irritated because you have set AutoCAD 2004 to save the drawings down to version 2000? This code is handy if you want to notify the user when a block is saved using WBLOCK or -WBLOCK in 2004 format even though the format in Options>Open and Save>Save as is set to 2000 DWG. You will get this question after creating a wblock.
The wblock is opened if you answer yes and then you can QSAVE and CLOSE it. You can put this in any existing code you have autoloaded or make sure you you have WblockTo2000.dvb autoloaded. If you don't have any acad.dvb file you can rename WblockTo2000.dvb to acad.dvb and place it at a path that is in the Support File Search Path. You cannot load VBA until an AutoCAD VBA command is issued. If you want to
load VBA automatically every time you start AutoCAD include the line acvba.arx
in the acad.rx file. ' By Jimmy Bergmark
' Copyright (C) 1997-2003 JTB World, All Rights Reserved
' Website: www.jtbworld.com
' E-mail: info@jtbworld.com
Dim strCMD As String
Dim strFileName As String
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
strCMD = CommandName
End Sub
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
If CommandName = "WBLOCK" Or CommandName = "-WBLOCK" Then
If ThisDrawing.Application.Preferences.OpenSave.SaveAsType <> ac2004_dwg Then
If MsgBox("Do you want to open this wblock that is saved in 2004 DWG format" & vbNewLine & _
"to be able to QSAVE it to 2000 DWG format?" & vbNewLine & vbNewLine & _
"Just QSAVE and CLOSE it if you want to.", vbYesNo) = vbYes Then
ThisDrawing.Application.Documents.Open (strFileName)
ThisDrawing.Application.Documents.Item(ThisDrawing.Application.Documents.Count - 1).Activate
End If
End If
End If
End Sub
Private Sub AcadDocument_EndSave(ByVal FileName As String)
strFileName = FileName
End Sub
|





