Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-17-2017, 03:32 PM
eduzs eduzs is offline Simple macro to create a copy Windows 10 Simple macro to create a copy Office 2010 32bit
Expert
Simple macro to create a copy
 
Join Date: May 2017
Posts: 262
eduzs is on a distinguished road
Default Simple macro to create a copy

To start a project of a code that will be in a file "base.docm" and will do the following:



It will create a copy of itself saving as "mycopy.docx".

Note that a simple copy and paste will not work cause the original file will have footers and headers etc.

Type the text "Hello" in this generated file.

Saves the generated file.

Close yourself without saving changes to itself.

Thanks a lot.
Reply With Quote
  #2  
Old 05-17-2017, 04:21 PM
macropod's Avatar
macropod macropod is offline Simple macro to create a copy Windows 7 64bit Simple macro to create a copy Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Making a copy of a file does not require VBA - you can do that from Windows Explorer. Furthermore, copying a file (even via SaveAs in VBA - which is all you'd need) has no effect on headers & footers.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-17-2017, 05:25 PM
eduzs eduzs is offline Simple macro to create a copy Windows 10 Simple macro to create a copy Office 2010 32bit
Expert
Simple macro to create a copy
 
Join Date: May 2017
Posts: 262
eduzs is on a distinguished road
Default

Thanks.

But the answer is so simple:

ActiveDocument.SaveAs FileName:="xxxxx.docx", fileformat:=wdFormatDocumentDefault
..........
Reply With Quote
  #4  
Old 05-17-2017, 05:34 PM
macropod's Avatar
macropod macropod is offline Simple macro to create a copy Windows 7 64bit Simple macro to create a copy Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Exactly as I said...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple macro to create a copy How to create Macro in Outlook 365 to copy to personal folder weety Outlook 3 09-05-2016 01:25 AM
a macro that can copy data from copy.xls to our current excel macro.xls based on criteria: udhaya Excel Programming 1 11-12-2015 10:12 AM
Simple macro to create a copy Create a simple application to print tags eamedeiros Office 1 05-09-2015 01:45 AM
Simple macro to create a copy Word 2013 create simple format list for bylaws astephens Word 3 07-14-2014 08:19 AM
How to create a resizeable simple checkbox Excel 2007 Imageman100 Excel 1 01-10-2014 11:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:47 AM.


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