Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default names in file name

Can I create a file name from Names or Named Ranges in a workbook?
If there are Names BorrowerName, LoanNumber, ReviewDate, in the WB,
can I do this:
ThisFile = BorrowerName & LoanNumber & ReviewDate & ".xls"
Application.Dialogs(xlDialogSaveAs).Show (ThisFile)
or something like that?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default names in file name

If they're named ranges (single cell ranges, too!), I'd use something like:

Dim ThisFile as string
thisfile = worksheets("sheet1").range("borrowerName").value _
& worksheets("Sheet2").range("loannumber").value _
& format(worksheets("Sheet3").range("reviewdate").va lue, "yyyy-mm-dd") _
& ".xls"

If one of them were a named constant(?), I'd use something like this to get it:

MsgBox Application.Evaluate(ActiveWorkbook.Names("Borrowe rName").RefersTo)



Slim Slender wrote:

Can I create a file name from Names or Named Ranges in a workbook?
If there are Names BorrowerName, LoanNumber, ReviewDate, in the WB,
can I do this:
ThisFile = BorrowerName & LoanNumber & ReviewDate & ".xls"
Application.Dialogs(xlDialogSaveAs).Show (ThisFile)
or something like that?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default names in file name

On Apr 28, 8:28*pm, Dave Peterson wrote:
If they're named ranges (single cell ranges, too!), I'd use something like:

Dim ThisFile as string
thisfile = worksheets("sheet1").range("borrowerName").value _
* * * * & worksheets("Sheet2").range("loannumber").value _
* * * * & format(worksheets("Sheet3").range("reviewdate").va lue, "yyyy-mm-dd") _
* * * * & ".xls"

If one of them were a named constant(?), I'd use something like this to get it:

MsgBox Application.Evaluate(ActiveWorkbook.Names("Borrowe rName").RefersTo)

SlimSlenderwrote:

Can I create a file name from Names or Named Ranges in a workbook?
If there are Names BorrowerName, LoanNumber, ReviewDate, in the WB,
can I do this:
ThisFile = BorrowerName & LoanNumber & ReviewDate & ".xls"
Application.Dialogs(xlDialogSaveAs).Show (ThisFile)
or something like that?


--

Dave Peterson


Dave,
Thanks again (you've helped me with several problems). Elegant syntax,
you even got the grammer right using the subjunctive where needed.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default names in file name

Watch your spelling <vbg.

When I have typos, I blame my fingers -- not my brain.



Slim Slender wrote:

<<snipped

Dave,
Thanks again (you've helped me with several problems). Elegant syntax,
you even got the grammer right using the subjunctive where needed.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Match file names listed in column with file names in folder K[_2_] Excel Programming 1 March 16th 09 04:26 PM
Open Excel file get error with file names that have spaces in the Kozmo Setting up and Configuration of Excel 6 October 29th 08 02:51 AM
vba to get file extension from col A file names StephCA Excel Programming 6 October 8th 08 01:09 AM
Open external data (varying file names) and closing file once data is retrieved Corrie Excel Programming 2 December 31st 06 09:56 PM
EXCEL97 FILE NAMES TRUNCATED TO THE FIRST LETTER IN THE FILE NAME Geoff Porter New Users to Excel 6 May 25th 06 08:31 PM


All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"