Application.Dialogs(?).Show
Application.Dialogs(?).Show
It appears that you can't, but as you are presumably programming styles in VBA, iut shouldn't be necessary. You can simply address the style directly, and if you need to get a value from a user, then employ an input box or a userform.
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
MsgBox "One would think that wdDialogEditStyle would be the ticket. It isn't. This will work though:"
Application.Dialogs(1347).Show
lbl_Exit:
Exit Sub
End Sub
Thanks, that works. You must be very smart. I never would have guessed 1347.
Can you tell me the purpose of the lbl_Exit: label in your subprogram?
Bob,
In this case no purpose really. It is just my unorthodox coding style. If I had an error handler it might look like this:
Code:Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
On Error GoTo Err_Handler
MsgBox "One would think that wdDialogEditStyle would be the ticket. It isn't. This will work though:"
Application.Dialogs(1347).Show
lbl_Exit:
Exit Sub
Err_Handler:
Msgbox Err.Number
Resume lbl_Exit
End Sub
This is a clumsy method, but it works, at least if run as a macro from within the text of the document, e.g. using a custom keyboard shortcut. (It depends on keyboard shortcut Alt+' being set to bring up the "Style" dialog box - I can't remember whether that was something I set up ages ago, or is the default - but the %' in each SendKeys statement could be modified to match whatever the shortcut is for you.)
If ActiveDocument.Styles(Selection.Style).BuiltIn Then
SendKeys "%'{tab}{tab}{enter}"
Else
SendKeys "%'{tab}{tab}{tab}{enter}"
End If