Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default vba, get filename of this workbook

I running a vba script inside a workbook. How do I get the complete
path to the workbook and name in which this script runs?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default vba, get filename of this workbook

On Mar 28, 8:46 pm, md wrote:
I running a vba script inside a workbook. How do I get the complete
path to the workbook and name in which this script runs?

Thanks


ActiveWorkbook.Path + '\' + ActiveWorkbook.Name (that was easy)
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default vba, get filename of this workbook

You may want to consider using ThisWorkbook if the workbook with the macro is
not the active workbook.
--
HTH,
Barb Reinhardt



"md" wrote:

On Mar 28, 8:46 pm, md wrote:
I running a vba script inside a workbook. How do I get the complete
path to the workbook and name in which this script runs?

Thanks


ActiveWorkbook.Path + '\' + ActiveWorkbook.Name (that was easy)

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default vba, get filename of this workbook

And you may want to use & instead of +.

+'s are used to add numbers.
&'s are used to concatenate strings.

But excel's VBA is forgiving.

ActiveWorkbook.Path & "\" & ActiveWorkbook.Name

or even:
Activeworkbook.fullname
or
ThisWorkbook.fullname



md wrote:

On Mar 28, 8:46 pm, md wrote:
I running a vba script inside a workbook. How do I get the complete
path to the workbook and name in which this script runs?

Thanks


ActiveWorkbook.Path + '\' + ActiveWorkbook.Name (that was easy)


--

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
Workbook name in VBA doesn't match filename.xls JoeAdidas21 Excel Discussion (Misc queries) 5 November 16th 07 03:37 PM
Saving XLS workbook with set filename levertonfamily Excel Discussion (Misc queries) 0 November 16th 06 05:52 PM
link to other workbook with changing filename DN Excel Worksheet Functions 6 August 30th 06 06:44 PM
Filename in footer automatically in new workbook. cmorton89 Excel Discussion (Misc queries) 1 March 9th 06 12:52 PM
How do I remove multiple windows of 1 workbook (filename.xls:2,:3 Stacey D. Excel Discussion (Misc queries) 2 March 1st 06 09:57 PM


All times are GMT +1. The time now is 02:49 AM.

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

About Us

"It's about Microsoft Excel"