Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to read spreadsheet's filename?
Hi,
I'm a novice at Excel VBA and looking for a way to retrieve the filename (e.g. asdfasdf.xls) of the current spreadsheet. Is there a way to do this? Thanks Jon |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to read spreadsheet's filename?
Jon,
Try something like Dim S As String S = ActiveWorkbook.Name ' or S = ThisWorkbook.Name Use FullName instead of Name if you want the full name (drive, folder, and file) of the file. -- Cordially, Chip Pearson Microsoft MVP - Excel www.cpearson.com "Jon" wrote in message om... Hi, I'm a novice at Excel VBA and looking for a way to retrieve the filename (e.g. asdfasdf.xls) of the current spreadsheet. Is there a way to do this? Thanks Jon |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to read spreadsheet's filename?
MsgBox ThisWorkbook.FullName
losmac Uzytkownik "Jon" napisal w wiadomosci om... Hi, I'm a novice at Excel VBA and looking for a way to retrieve the filename (e.g. asdfasdf.xls) of the current spreadsheet. Is there a way to do this? Thanks Jon |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA to read spreadsheet's filename?
Which is probably what Jon really would wanted but not what he asked for.
More details on my http://www.mvps.org/dmcritchie/excel/pathname.htm Page also has worksheet solutions as well as main emphasis on headers/footers.. Code in VBA Description VBA codeExample Full Name: Application.ActiveWorkbook.FullName D:\TestFolder\test.xls Path: Application.ActiveWorkbook.Path C:\MSOffice\Excel Filename: Application.ActiveWorkbook.Name test.xls Sheetname: application.activesheet.name Sheet1 --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "losmac" wrote in message ... MsgBox ThisWorkbook.FullName losmac Uzytkownik "Jon" napisal w wiadomosci om... Hi, I'm a novice at Excel VBA and looking for a way to retrieve the filename (e.g. asdfasdf.xls) of the current spreadsheet. Is there a way to do this? Thanks Jon |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Forcing a Read Only Filename | Excel Discussion (Misc queries) | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
Why is my Excel spreadsheet's sorting not being remembered? | Excel Discussion (Misc queries) | |||
Copy one spreadsheet into another without activating second spreadsheet's user form | Excel Programming |