Undo apply styles via VBA

C

CJ

Word 2003 XP
Heading styles are applied via a macro button. Any way to make undo work
after applying styles this way?
 
D

David Horowitz

I'm testing in Word XP (2002) with a macro like this:
Sub ChangeStyle()
Selection.Style = ActiveDocument.Styles("Heading 1")
End Sub
After running this macro, I am able to hit Undo and it works fine. When I
pull down the Edit menu, the Undo command says "Undo VBA-Selection.Style".
So I'm not sure I see an issue...
 
D

Dorak

Thanks, Dave. The code we're using actually is thus:

Sub ApplyH3()
VerifyApply ("Heading 3")
Selection.StartOf Unit:=wdParagraph
Selection.MoveEnd Unit:=wdParagraph
Selection.Range.Case = wdTitleWord
End Sub

I will try yours and see how it goes. My apologies, I should have supplied
the code I was using.....
 
D

Dorak

Unfortunately, I still get "Can't Undo".

David Horowitz said:
I'm testing in Word XP (2002) with a macro like this:
Sub ChangeStyle()
Selection.Style = ActiveDocument.Styles("Heading 1")
End Sub
After running this macro, I am able to hit Undo and it works fine. When I
pull down the Edit menu, the Undo command says "Undo VBA-Selection.Style".
So I'm not sure I see an issue...
--
David Horowitz
Lead Technologist
Soundside Inc.
www.soundside.biz
 
C

CJ

Oh, I just noticed I'm two people in this message. I am Dorak and I am CJ.
If I log into my home email from work and forget to log out then I appear as
Dorak, which was what happened today when I responded earlier. My apologies,
I didn't notice until when I got the response.

----CJ Dorak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top