Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 11-17-2017, 01:40 PM
macropod's Avatar
macropod macropod is offline Creating a macro from a non-saved Word doc that duplicates the current open document and saves it Windows 7 64bit Creating a macro from a non-saved Word doc that duplicates the current open document and saves it Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,523
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Either way, you don't need all this copy/paste stuff; simply save the document you opened with a new name. Whether you do that before modifying it, or after (or even before and after), is immaterial. For example:
Code:
Sub Demo()
Dim strDoc As String
With ActiveDocument
  'get the source document's name
  Set strDoc = .FullName
  'modify the document
  'save the document via the SaveAs dialogue
  .Application.Dialogs(wdDialogFileSaveAs).Show
  'modify the document
  'close & save any changes to the document
  .Close True
End With
'reopen the source document
Documents.Open (strDoc)
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
copy, save document, word vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
My Word 10 won't open it's own saved files because it says they are corrupted Dave Young Word 5 11-05-2016 09:13 PM
Some images not saved when creating PDF from Word with Acrobat WaltR Word 5 09-26-2015 02:58 PM
Creating a macro from a non-saved Word doc that duplicates the current open document and saves it Word 2003 document saves as Wordpad docx Rick K Word 2 05-06-2015 08:25 AM
Creating a macro from a non-saved Word doc that duplicates the current open document and saves it Cannot open saved Word document otherlunds Word 1 09-01-2014 05:41 AM
Creating a macro from a non-saved Word doc that duplicates the current open document and saves it Run-time error '1004': Document not saved. The document may be open... doctor_who12 Excel Programming 1 01-22-2014 04:47 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft