How to open a workbook as a copy?

  • Thread starter Thread starter c mateland
  • Start date Start date
C

c mateland

Excel 2003

Sorry, I'm drawing a blank. I just want VBA to open an existing xls as
a copy. The user will then save it where it needs to go.

Example path and file:
c:\shared files\projects\mccoy.xls

Another scenario is if it's a template file:
c:\shared files\projects\mccoy.xlt

Thanks,
Chuck
 
sName = "c:\shared files\projects\mccoy.xls"
workbooks.open sName, ReadOnly:=True
 
Maybe you could open it as a readonly document:

Dim wkbk As Workbook
Set wkbk = Workbooks.Open(Filename:="book1.xls", ReadOnly:=True)

Or open it as a template:

Dim wkbk As Workbook
Set wkbk = Workbooks.Add(template:="book1.xls")

I would think that each would keep the original safe.
 
"or open as a template" should have been phrased "or create a new workbook using
the existing file as a template".
 
That was it! I couldn't remember the strategy on doing it.

Thanks a bunch!

-Chuck
 
if you want to open the orginal template for editing to be saved with another
name but still as a template, then add

Editable:=True

as well. Of course the User would have to choose to save it as a template I
believe.
 

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

Back
Top