ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   saving files (https://www.excelbanter.com/excel-programming/368081-saving-files.html)

dr chuck

saving files
 
I would like to open a new xls file using the contents of 3 named ranges on
the current worksheet as the name of the new file.

The named range "mnf" "lot" and "exp"
ie (mnf=john, lot =gh , exp=09022006)

I would like to get the file name to be "mnf""lot""exp".xls
(ie johngh09022006.xls)

Any suggestions? Do i have to open a unnamed file then name it when i save it?

ty for any help

dr chuck

Tom Ogilvy

saving files
 
Yes, you have to do a saveas to rename a file

Dim s as String, bk as Workbook
s = Range("mnf").Value & Range("lot").Value & _
Format(Range("exp").Value,"mmddyyyy") & ".xls"
set bk = Workbooks.Add()
bk.SaveAs Thisworkbook.Path & "\" & s

--
Regards,
Tom Ogilvy

"dr chuck" wrote in message
...
I would like to open a new xls file using the contents of 3 named ranges on
the current worksheet as the name of the new file.

The named range "mnf" "lot" and "exp"
ie (mnf=john, lot =gh , exp=09022006)

I would like to get the file name to be "mnf""lot""exp".xls
(ie johngh09022006.xls)

Any suggestions? Do i have to open a unnamed file then name it when i save
it?

ty for any help

dr chuck




dr chuck

saving files
 
thanks Tom,
Your information is always very helpful.
Wish I had the working knowledge of this that you do.

--
dr chuck


"Tom Ogilvy" wrote:

Yes, you have to do a saveas to rename a file

Dim s as String, bk as Workbook
s = Range("mnf").Value & Range("lot").Value & _
Format(Range("exp").Value,"mmddyyyy") & ".xls"
set bk = Workbooks.Add()
bk.SaveAs Thisworkbook.Path & "\" & s

--
Regards,
Tom Ogilvy

"dr chuck" wrote in message
...
I would like to open a new xls file using the contents of 3 named ranges on
the current worksheet as the name of the new file.

The named range "mnf" "lot" and "exp"
ie (mnf=john, lot =gh , exp=09022006)

I would like to get the file name to be "mnf""lot""exp".xls
(ie johngh09022006.xls)

Any suggestions? Do i have to open a unnamed file then name it when i save
it?

ty for any help

dr chuck






All times are GMT +1. The time now is 11:57 AM.

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