I have written a short vba routine to change the "Dimtad" variable to 0 so that leader text is placed at the end of the line instead of on top of it. The routine then restores the "Dimtad" value back to the value before the routine is invoked. But I am having a problem, code is below this is placed in a module and called via a button:
Sub cmdleader()
Dim mydoc As intellicad.Document
Dim curdimtad As Double
Dim mydimtad As Double
Set mydoc = intellicad.ActiveDocument
curdimtad = mydoc.GetVariable("dimtad")
mydimtad = "0"
mydoc.SetVariable "dimtad", mydimtad
mydoc.Application.RunCommand "_dimleader"
mydoc.SetVariable "dimtad", curdimtad
End Sub
This works except when the dimleader command is called vba continues with the next line not waiting for the leader command to finish thus restoring the Dimtad variable back to the original before the leader command is finished. It works fine if the routine is manually stepped through.
What do I need to do in order to make the leader command halt the routine until the leader is drawn??
Thank you,
Scott
#2
Here is what I did to make it work. I had to set up a toolbar button with a command macro that calls two vba routines and the leadear command as follows:
Toolbar Button:
^C^C^C(Command "-VBARUN" "ScottLeader.cmdleader"); _dimleader;(Command "-VBARUN" "ScottLeader.Edimtad")
VBA Module:
Public mydoc As intellicad.Document
Public curdimtad As Double
Sub cmdleader()
Dim mydimtad As Double
Set mydoc = intellicad.ActiveDocument
curdimtad = mydoc.GetVariable("dimtad")
mydimtad = "0"
mydoc.SetVariable "dimtad", mydimtad
End Sub
'Set up a toolbar button with the following command macro:
'^C^C^C(Command "-VBARUN" "ScottLeader.cmdleader"); _dimleader;(Command "-VBARUN" "ScottLeader.Edimtad")
Sub Edimtad()
mydoc.SetVariable "dimtad", curdimtad
End Sub
Any way to make the vba routine to pause and let the command run other than to have a msgbox pop or something like that? The above works.
Scott
Toolbar Button:
^C^C^C(Command "-VBARUN" "ScottLeader.cmdleader"); _dimleader;(Command "-VBARUN" "ScottLeader.Edimtad")
VBA Module:
Public mydoc As intellicad.Document
Public curdimtad As Double
Sub cmdleader()
Dim mydimtad As Double
Set mydoc = intellicad.ActiveDocument
curdimtad = mydoc.GetVariable("dimtad")
mydimtad = "0"
mydoc.SetVariable "dimtad", mydimtad
End Sub
'Set up a toolbar button with the following command macro:
'^C^C^C(Command "-VBARUN" "ScottLeader.cmdleader"); _dimleader;(Command "-VBARUN" "ScottLeader.Edimtad")
Sub Edimtad()
mydoc.SetVariable "dimtad", curdimtad
End Sub
Any way to make the vba routine to pause and let the command run other than to have a msgbox pop or something like that? The above works.
Scott