Message 1 of 3
Intercepting Commands or Starting New Dwg with Template

Not applicable
12-21-2000
04:35 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I added the /t "acad.dwt" parameter to the icon target field, but all the
NEW drawings do not use the template file. I need to start NEW dwgs with
the acad.dwt template. If this can be done easily, please let me know.
Otherwise, I'd like to know how to use reactors in VBA which would let me
open a new drawing with a specific template. I have the BeginCommand event
set up to display a message if the command is "NEW", so I have the structure
correct. My problem is when I use the Documents.Add method, the document is
added with the template file, then the NEW command continues to run. There
is no Cancel variable to set which can cancel the command from within the
BeginCommand routine. I also tried redefing CommandName within the routine,
but that didn't work either. How can I cancel the command in progress from
within the reactor routine?
Public WithEvents MyEvents As AcadApplication
Private Sub MyEvents_BeginCommand(ByVal CommandName As String)
' intercepts commands issued from Autocad to do custom functions
MsgBox CommandName
Select Case CommandName
Case "NEW"
Set Doc = Application.Documents.Add("acad.dwt")
CommandName = "help"
End Select
End Sub
Hey, I'm open to easier ways, too!
Thanks,
Keith
NEW drawings do not use the template file. I need to start NEW dwgs with
the acad.dwt template. If this can be done easily, please let me know.
Otherwise, I'd like to know how to use reactors in VBA which would let me
open a new drawing with a specific template. I have the BeginCommand event
set up to display a message if the command is "NEW", so I have the structure
correct. My problem is when I use the Documents.Add method, the document is
added with the template file, then the NEW command continues to run. There
is no Cancel variable to set which can cancel the command from within the
BeginCommand routine. I also tried redefing CommandName within the routine,
but that didn't work either. How can I cancel the command in progress from
within the reactor routine?
Public WithEvents MyEvents As AcadApplication
Private Sub MyEvents_BeginCommand(ByVal CommandName As String)
' intercepts commands issued from Autocad to do custom functions
MsgBox CommandName
Select Case CommandName
Case "NEW"
Set Doc = Application.Documents.Add("acad.dwt")
CommandName = "help"
End Select
End Sub
Hey, I'm open to easier ways, too!
Thanks,
Keith