Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / February 2007

Tip: Looking for answers? Try searching our database.

using environment variable in macro path

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
M. Mix - 14 Feb 2007 17:10 GMT
Hiho,

at first i am sorry for the double post but i hope to get an answer here
because some peaple don´t look in the programming newsgroup but do here...

I have a problem with a macro which is linked behind an excel button.
I want to use the environment variable %USERPROFILE% in the macro path
because the macro is been used from many users.

The path at this time is hard coded: C:\Dokumente und
Einstellungen\mmustermann\Eigene
Dateien\Anwendungsdaten\Microsoft\Excel\XLStart\PERSONL.XLS

I want to modify the path to:
%USERPROFILE%\Anwendungsdaten\Microsoft\Excel\XLStart\PERSONL.XLS

When i modify the path the result is the following: C:\Dokumente und
Einstellungen\mmustermann\Eigene
Dateien\%USERPOROFILE%\Anwendungsdaten\Microsoft\Excel\XLStart\PERSONL.XLS

Any hints how to solve this ?

Thx

Markus
Chip Pearson - 14 Feb 2007 22:25 GMT
Use the Environ function:

Dim FolderName As String
FolderName = Environ("UserProfile")
Debug.Print FolderName &
"\Anwendungsdaten\Microsoft\Excel\XLStart\PERSONL.XLS"

Signature

Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)

> Hiho,
>
[quoted text clipped - 21 lines]
>
> Markus
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.