macro to save rtf file as txt

G

Guest

I am trying to create a macro that will save a .rtf file as a .txt file with
the same name. I can get it to work with one exception. The saved .txt name
is always the one that I used when I created the macro.

For instance, I create and save a file "test.rtf". I create a macro with the
following steps. File, Save as, Save as type changed to .txt, click on Save.
I now have a file "test.txt". I then create and save file "test2.rtf". When I
run the macro, it saves it as "test.txt" and not "test2.txt". Any help with
how to get it to save the .txt file with the same name as the .rtf file would
be greatly appreciated.
 
J

Jezebel

You can't do this sort of thing simply by recording the macro. You'll need
to switch to VBA (Alt-F11) and do it by hand -- get the rtf file name into a
variable, change the extension to txt, do your saveas.
 

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