Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Worksheet to be saved in current directory

At the end of a macro I save the worksheet. The following statement works for
me, but how should the code be to make this work on another users computer
with another directory structure? (I copied this statement from another
answer - my knowledge of VBA is very limited!)
I save with:
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Owner\My
Documents\VvEAH\Finance\2007\Bookdoc " & Format(Now, "yyyy-mm") & ".xls"
The question is actually: how do I get the path of the worksheet in use and
use that in the save statement?
Thanks,
Paul
P.S. I asked this question earlier, but cannot find it back.....!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Worksheet to be saved in current directory

Give this a whirl...

ActiveWorkbook.SaveAs Filename:=Thisworkbook.Path & "\Bookdoc " &
Format(Now, "yyyy-mm") & ".xls"

--
HTH...

Jim Thomlinson


"Pepestru" wrote:

At the end of a macro I save the worksheet. The following statement works for
me, but how should the code be to make this work on another users computer
with another directory structure? (I copied this statement from another
answer - my knowledge of VBA is very limited!)
I save with:
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Owner\My
Documents\VvEAH\Finance\2007\Bookdoc " & Format(Now, "yyyy-mm") & ".xls"
The question is actually: how do I get the path of the worksheet in use and
use that in the save statement?
Thanks,
Paul
P.S. I asked this question earlier, but cannot find it back.....!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Worksheet to be saved in current directory

If you want to save the workbook in the same path as the active workbook,
this should work:

ActiveWorkbook.SaveAs Filename= activeworkbook.path & "\Bookdoc " &
Format(Now, "yyyy-mm") & ".xls"

James

"Pepestru" wrote in message
...
At the end of a macro I save the worksheet. The following statement works
for
me, but how should the code be to make this work on another users computer
with another directory structure? (I copied this statement from another
answer - my knowledge of VBA is very limited!)
I save with:
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Owner\My
Documents\VvEAH\Finance\2007\Bookdoc " & Format(Now, "yyyy-mm") & ".xls"
The question is actually: how do I get the path of the worksheet in use
and
use that in the save statement?
Thanks,
Paul
P.S. I asked this question earlier, but cannot find it back.....!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Worksheet to be saved in current directory

Jim, that's fast!
And it works for me. I will sent it to another user to test it. I am
confident it will.
Many thanks,
Paul

"Jim Thomlinson" wrote:

Give this a whirl...

ActiveWorkbook.SaveAs Filename:=Thisworkbook.Path & "\Bookdoc " &
Format(Now, "yyyy-mm") & ".xls"

--
HTH...

Jim Thomlinson


"Pepestru" wrote:

At the end of a macro I save the worksheet. The following statement works for
me, but how should the code be to make this work on another users computer
with another directory structure? (I copied this statement from another
answer - my knowledge of VBA is very limited!)
I save with:
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Owner\My
Documents\VvEAH\Finance\2007\Bookdoc " & Format(Now, "yyyy-mm") & ".xls"
The question is actually: how do I get the path of the worksheet in use and
use that in the save statement?
Thanks,
Paul
P.S. I asked this question earlier, but cannot find it back.....!

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
How to display the current directory for existing worksheet? Eric Excel Discussion (Misc queries) 1 December 4th 08 08:04 AM
current directory Ross[_2_] Excel Discussion (Misc queries) 1 April 2nd 07 10:00 PM
Current Directory Mallasch Excel Discussion (Misc queries) 4 September 15th 06 03:05 AM
get current directory Souris Excel Programming 1 September 27th 05 11:53 AM
changing current directory to that of the current open file unnameable Excel Programming 2 May 19th 04 11:14 AM


All times are GMT +1. The time now is 03:07 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"