ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Active Workbook Path (https://www.excelbanter.com/excel-programming/423336-active-workbook-path.html)

Dorci

Active Workbook Path
 
Excel 2003 - I can't seem to capture the path of the current workbook. My
workbook is located at ...\My Documents\Temp Forms\ but

MsgBox ThisWorkbook.Path returns ...\Microsoft\Excel\XLSTART
and
MsgBox ActiveWorkbook.Path returns nothing

I'm trying to save one worksheet of a workbook in the "same" directory
(whatever that happens to be at a given time). The saving part of my macro
works, but the path part doesn't.

Thanks in advance for your help.


John Bundy

Active Workbook Path
 
It looks like you are running the code in you personal workbook as that is
its address. Putting ThisWorkbook.Path in your personal.xls returns what you
saw, putting it in the activeworkbook you get the correct answer.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Dorci" wrote:

Excel 2003 - I can't seem to capture the path of the current workbook. My
workbook is located at ...\My Documents\Temp Forms\ but

MsgBox ThisWorkbook.Path returns ...\Microsoft\Excel\XLSTART
and
MsgBox ActiveWorkbook.Path returns nothing

I'm trying to save one worksheet of a workbook in the "same" directory
(whatever that happens to be at a given time). The saving part of my macro
works, but the path part doesn't.

Thanks in advance for your help.


Dorci

Active Workbook Path
 
I need the macro to be available in any workbook that is opened. Is there
some way to keep the macro in personal.xls (which is hidden) but refer to the
active workbook? -Thanks.

"John Bundy" wrote:

It looks like you are running the code in you personal workbook as that is
its address. Putting ThisWorkbook.Path in your personal.xls returns what you
saw, putting it in the activeworkbook you get the correct answer.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Dorci" wrote:

Excel 2003 - I can't seem to capture the path of the current workbook. My
workbook is located at ...\My Documents\Temp Forms\ but

MsgBox ThisWorkbook.Path returns ...\Microsoft\Excel\XLSTART
and
MsgBox ActiveWorkbook.Path returns nothing

I'm trying to save one worksheet of a workbook in the "same" directory
(whatever that happens to be at a given time). The saving part of my macro
works, but the path part doesn't.

Thanks in advance for your help.



All times are GMT +1. The time now is 10:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com