Gettin File name in macro

  • Thread starter Thread starter redf1re
  • Start date Start date
R

redf1re

Hi... is it possible by macro to know its file name??? something like
variable receaving "teste.xls" as valu
 
Something like

Sub GetWorkbookName()
Dim wbName As String
wbName = ActiveWorkbook.Name
MsgBox wbName & ".xls"
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
(e-mail address removed)
 
You can get it via:

activeworkbook.name
activeworkbook.fullname
and maybe you'd want
activeworkbook.path

..fullname will include the path. .Path will just give the path.

But both .name and .fullname will include any extension (if the file was saved
with an extension).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top