View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default 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