antmjr
Guest
|
Posted:
Fri Apr 01, 2005 10:03 am Post subject:
Re: macro doesn't start |
|
|
I haven't a particular macro not working, suddenly all my macros do not work; it seems to me that there may be something still active when I try to start one of my macros. I was thinking the cause might lie in some events, so I unloaded the only macro using them; in Thisdrawing Module I still have the following:
Option Explicit
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Const ALERT_1 As Long = 5000
Private Const ALERT_2 As Long = 100
Private Const VK_CAPITAL = &H14
Private Const KEYEVENTF_KEYUP = &H2
Private Const KEYEVENTF_EXTENDEDKEY = &H1
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
Select Case CommandName
Case "MOVE"
Call Beep(ALERT_1, 150)
Case "DIMCONTINUE", "DIMALIGNED", "DIMLINEAR", "DIMANGULAR", "DIMORDINATE", _
"DIMBASELINE", "DIMDIAMETER", "DIMRADIUS", "DIMBASELINE", "LEADER", _
"QLEADER"
If Not (UCase(ThisDrawing.ActiveLayer.Name) Like "QUOTE*") Then
Call Beep(ALERT_1, 150)
End If
Case "DDEDIT"
'if you are DDEDITing, it switches to CAPITAL letter and alerts with a beep
If GetKeyState(VK_CAPITAL) = 0 Then
On Error GoTo GO_ON 'I don't remember why I have written it this way
Call keybd_event(vbKeyCapital, _
MapVirtualKey(vbKeyCapital, 0), _
KEYEVENTF_EXTENDEDKEY, 0)
Call keybd_event(vbKeyCapital, MapVirtualKey(vbKeyCapital, 0), _
KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)
GO_ON:
Call Beep(ALERT_2, 150)
End If
Case "PLOT"
ThisDrawing.SetVariable "TEXTFILL", 1
Case Else
'per studio:
' ThisDrawing.Utility.Prompt "* " & CommandName & " *"
End Select
End Sub
- - -
another possibility might be that there are some variables conflicting each other: is it possible that they can cause all the macros not to work?
|
|