I want to manipulate add-in app dialogs with word vba's sendkey method.

97 matushiro 0 Reputation points
2023-09-06T02:27:11.46+00:00

I have a mathtype, which is a formula generator for word.

I want to do the following operations with word VBA.

(1) Open the currently selected mathtypep object.

(2) Select all the contents in the opened dialog by pressing "Ctrl+A" key.

(3) "Ctrl+E" key operation in the opened dialog.

(4) Execute "Ctrl+F4" to close the opened dialog.

All of these operations can be performed manually. To do this with word VBA, I wrote the following code.

Application.Run MacroName:="MathTypeCommands.UILib.MTCommand_EditEquationOpen"

SendKeys "^A", True 'Ctrl+A

SendKeys "^+", True 'Ctrl+"+"

SendKeys "^{F4}", True 'Ctrl+F4

The first line works and opens the dialog; the second and subsequent lines do not respond. Is the sendokey method from word disabled even if another application's dialog is active? If not, is there another way?

Word
Word
A family of Microsoft word processing software products for creating web, email, and print documents.
814 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.