ill_comms
08-19-2008, 10:31 PM
Hi, I have a Word Macro that does the following:
1. Opens Word document with macro in it "DOC1".
2. Creates a new document "DOC2".
3. Opens another document "DOC3" that is acting like a template of sorts.
4. DOC2 is selected and copies the entire document to the clipboard. Then pastes it into DOC3.
Documents(templateDocumentName).Select
Selection.WholeStory
Selection.Copy
Documents(newDocumentName).Activate
Selection.PasteAndFormat (wdPasteDefault)
This works perfectly in XP however falls over when run in Vista, both machines are using Office 2003.
The error is occuring on: "Selection.PasteAndFormat (wdPasteDefault)" and only producing a "Command Failed" error.
What could be causing this and does anyone have a fix?
Regards Hayden
1. Opens Word document with macro in it "DOC1".
2. Creates a new document "DOC2".
3. Opens another document "DOC3" that is acting like a template of sorts.
4. DOC2 is selected and copies the entire document to the clipboard. Then pastes it into DOC3.
Documents(templateDocumentName).Select
Selection.WholeStory
Selection.Copy
Documents(newDocumentName).Activate
Selection.PasteAndFormat (wdPasteDefault)
This works perfectly in XP however falls over when run in Vista, both machines are using Office 2003.
The error is occuring on: "Selection.PasteAndFormat (wdPasteDefault)" and only producing a "Command Failed" error.
What could be causing this and does anyone have a fix?
Regards Hayden