ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Make directory structure variable (https://www.excelbanter.com/excel-programming/383807-make-directory-structure-variable.html)

Pepestru

Make directory structure variable
 
A macro ends with saving the worksheet. It works for me, but but not for
other users that use my worksheet on their PC. I found my solution in the
knowledge base, but I cant find how to make it flexible.
My macro ends with:
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Owner\My
Documents\VvEAH\Financ\2007\Bookdoc " & Format(Now, "yyyy-mm") & ".xls"
How do I adjust this statement to make it usefull for all users.
Thanks for your help.
Paul

Dave Peterson

Make directory structure variable
 
You can find the "my documents" path with something like:

Option Explicit
Sub testme()
Dim myDocumentsPath As String

Dim wsh As Object

Set wsh = CreateObject("WScript.Shell")
myDocumentsPath = wsh.SpecialFolders.Item("mydocuments")

MsgBox myDocumentsPath

End Sub



Pepestru wrote:

A macro ends with saving the worksheet. It works for me, but but not for
other users that use my worksheet on their PC. I found my solution in the
knowledge base, but I cant find how to make it flexible.
My macro ends with:
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\Owner\My
Documents\VvEAH\Financ\2007\Bookdoc " & Format(Now, "yyyy-mm") & ".xls"
How do I adjust this statement to make it usefull for all users.
Thanks for your help.
Paul


--

Dave Peterson


All times are GMT +1. The time now is 01:53 PM.

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