• WSmandelbrot

    WSmandelbrot

    @wsmandelbrot

    Viewing 15 replies - 16 through 30 (of 38 total)
    Author
    Replies
    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850953

      Hi, Jefferson. Do you something like this attatchment? In this document, there are some sample macros. SetHook( ) tries to set an event hook for the font color button. However, when I assign that control to a button variable, the VB interpreter says that “type mismatch”. In fact, it is not a “msoControlButton” but a “msoControlSplitDropdown”. Although a variable of msoCommandBarControl type can handl it, but such a variable does not any event.

      Actually, I found 3 approaches to intercept the commands for Word. The first 1 is to set the event listeners for buttons. The second one is to change the onAction attribute. The last one is to create overriding macros with the same command name. None of them is a complete solution, but I am considering whether a combination would meet my requirement.

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850894

      This approach works perfect for buttons. It even allows me to cancel the user actions. But for combo boxes, it only notifies me. What’s worse is that for some complex controls (such as undo, font color, fill color), it does not work any more. When the attatched combo box changes, I get the notification. But if the main button (e.g. undo button) is clicked, there is no way to intercept it.

      Is there anyting complemetary to this approach?

      Regards

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850895

      This approach works perfect for buttons. It even allows me to cancel the user actions. But for combo boxes, it only notifies me. What’s worse is that for some complex controls (such as undo, font color, fill color), it does not work any more. When the attatched combo box changes, I get the notification. But if the main button (e.g. undo button) is clicked, there is no way to intercept it.

      Is there anyting complemetary to this approach?

      Regards

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850833

      Another problem of using caption is that it changes during the running process. For example, the caption of the undo button is “Can’t Undo”. And then it becomes “Undo sth…”. Are there any other ways not so troublesome?

      Regards

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850834

      Another problem of using caption is that it changes during the running process. For example, the caption of the undo button is “Can’t Undo”. And then it becomes “Undo sth…”. Are there any other ways not so troublesome?

      Regards

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850823

      Hi, Andrew. I cannot make it work with Howard’s code either. If you find the reason, can you put it here please?

      Thanks

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850824

      Hi, Andrew. I cannot make it work with Howard’s code either. If you find the reason, can you put it here please?

      Thanks

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850420

      I think it works better to monitor the button events than my initial idea to override the buttons. It also works for other Office application. I will try this one.

      Thanks, Jefferson.

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850421

      I think it works better to monitor the button events than my initial idea to override the buttons. It also works for other Office application. I will try this one.

      Thanks, Jefferson.

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850384

      In my Word 2K the command DrawGroup showed up when I executed ListCommands but it does not in my Word XP. However, when I created the macro DrawGroup in Word XP, it automatically put the statement WordBasic.DrawGroup in the sub, which acknowledges that it is an internal command in Word (I think). But neither version works to intercept.

      What a strange application! I don’t know what they are thinking about when they designed it.

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850385

      In my Word 2K the command DrawGroup showed up when I executed ListCommands but it does not in my Word XP. However, when I created the macro DrawGroup in Word XP, it automatically put the statement WordBasic.DrawGroup in the sub, which acknowledges that it is an internal command in Word (I think). But neither version works to intercept.

      What a strange application! I don’t know what they are thinking about when they designed it.

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850382

      I tried in both 2K and XP but failed in both. I do not have a Word 2003 at hand so cannot test. Is it a bug only solved in 2003? But it seems unlikely.

      I put the Sub in the “All active templates and documents”. The code is rather simple and I cannot see any error in it.

      Sub DrawGroup()

      MsgBox (“Group”)
      WordBasic.DrawGroup

      End Sub

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850383

      I tried in both 2K and XP but failed in both. I do not have a Word 2003 at hand so cannot test. Is it a bug only solved in 2003? But it seems unlikely.

      I put the Sub in the “All active templates and documents”. The code is rather simple and I cannot see any error in it.

      Sub DrawGroup()

      MsgBox (“Group”)
      WordBasic.DrawGroup

      End Sub

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850337

      Thanks anyway. At least I can intercept some of them based on your previous posts.

    • in reply to: Intercepting Word Commands? (Word 2K/XP) #850338

      Thanks anyway. At least I can intercept some of them based on your previous posts.

    Viewing 15 replies - 16 through 30 (of 38 total)