1

Is there a way to save a selected block of text to an RTF document without opening a new document, pasting the content in the new document, saving the new document, and then returning to the original doc? That's a lot of hoops to jump through when all I want to do is highlight a block of text, right click, and select "Save As".

I tried creating a macro to do the same, but there's a lot of screen switching going on and I can't find a way to reliably return to my original document, eg. if I have multiple documents open, I often get returned to a random document vs. the document I started with.

1 Answer 1

0

Are you using the windows(FILENAME).Activate function to pop between windows? It is an effective way to do it. Here is an example, however I am assuming this may not be what you are looking for:

Windows(FileName).Activate
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
    .Text = "Paste2_LE_SUMHere"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindAsk
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.PasteAndFormat (wdPasteDefault)

I am having RTF woes as well. I have a macro that requires I open an RTF, select all of the contents of the document and paste it to a .docx file. I have no trouble accessing the .docx file, however am never able to switch to the RTF file. I consistently get an error : Run-time error 5491 - The requested member of the collection does not exist. I get this error regardless of whether I am using relative or absolute pathing, or just try to access the filename directly. Any thoughts?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .