ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to open a workbook as a copy? (https://www.excelbanter.com/excel-programming/385359-how-open-workbook-copy.html)

c mateland

How to open a workbook as a copy?
 
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


Tom Ogilvy

How to open a workbook as a copy?
 

sName = "c:\shared files\projects\mccoy.xls"
workbooks.open sName, ReadOnly:=True

--
Regards,
Tom Ogilvy

"c mateland" wrote:

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



Dave Peterson

How to open a workbook as a copy?
 
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.

c mateland wrote:

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


--

Dave Peterson

Dave Peterson

How to open a workbook as a copy?
 
"or open as a template" should have been phrased "or create a new workbook using
the existing file as a template".

Dave Peterson wrote:

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.

c mateland wrote:

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


--

Dave Peterson


--

Dave Peterson

c mateland

How to open a workbook as a copy?
 
That was it! I couldn't remember the strategy on doing it.

Thanks a bunch!

-Chuck

On Mar 15, 12:44 pm, Tom Ogilvy
wrote:
sName = "c:\shared files\projects\mccoy.xls"
workbooks.open sName, ReadOnly:=True

--
Regards,
Tom Ogilvy



"c mateland" wrote:
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




Tom Ogilvy

How to open a workbook as a copy?
 
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.

--
Regards,
Tom Ogilvy


"c mateland" wrote:

That was it! I couldn't remember the strategy on doing it.

Thanks a bunch!

-Chuck

On Mar 15, 12:44 pm, Tom Ogilvy
wrote:
sName = "c:\shared files\projects\mccoy.xls"
workbooks.open sName, ReadOnly:=True

--
Regards,
Tom Ogilvy



"c mateland" wrote:
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






All times are GMT +1. The time now is 08:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com