Code for undo

M

Margaret Upton

Could anyone tell me what the code would be for undo. I can only record
macros and put in bits of code that I know. I want a macro to copy selected
text change it to upper case so that I can switch documents and paste, but I
want the text I have changed to upper case to revert back and the macro
record will not let me undo the changes, so could anyone give me the line of
code please. I would be very grateful for some help.

Margaret
 
M

macropod

Hi Margaret,

Try:
Application.Undo

For future reference, Word's VBE Help file is a good place to look for pointers on whatever you might want to (un)do.

Cheers
 
M

Margaret Upton

Thanks for your reply, but it does not work, it highlights the Undo when you
go into the macro.

Margaret


macropod said:
Hi Margaret,

Try:
Application.Undo

For future reference, Word's VBE Help file is a good place to look for
pointers on whatever you might want to (un)do.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Margaret Upton said:
Could anyone tell me what the code would be for undo. I can only record
macros and put in bits of code that I know. I want a macro to copy
selected text change it to upper case so that I can switch documents and
paste, but I want the text I have changed to upper case to revert back
and the macro record will not let me undo the changes, so could anyone
give me the line of code please. I would be very grateful for some help.

Margaret
 
S

Stefan Blom

Try ActiveDocument.Undo instead.

--
Stefan Blom
Microsoft Word MVP


in message
Thanks for your reply, but it does not work, it highlights the Undo when you
go into the macro.

Margaret


macropod said:
Hi Margaret,

Try:
Application.Undo

For future reference, Word's VBE Help file is a good place to look for
pointers on whatever you might want to (un)do.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Margaret Upton said:
Could anyone tell me what the code would be for undo. I can only record
macros and put in bits of code that I know. I want a macro to copy
selected text change it to upper case so that I can switch documents and
paste, but I want the text I have changed to upper case to revert back
and the macro record will not let me undo the changes, so could anyone
give me the line of code please. I would be very grateful for some help.

Margaret
 
M

Margaret Upton

Thank you so much, that works.

Margaret

Stefan Blom said:
Try ActiveDocument.Undo instead.

--
Stefan Blom
Microsoft Word MVP


in message
Thanks for your reply, but it does not work, it highlights the Undo when you
go into the macro.

Margaret


macropod said:
Hi Margaret,

Try:
Application.Undo

For future reference, Word's VBE Help file is a good place to look for
pointers on whatever you might want to (un)do.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

Could anyone tell me what the code would be for undo. I can only record
macros and put in bits of code that I know. I want a macro to copy
selected text change it to upper case so that I can switch documents and
paste, but I want the text I have changed to upper case to revert back
and the macro record will not let me undo the changes, so could anyone
give me the line of code please. I would be very grateful for some help.

Margaret
 

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