Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Help needed.
I developed a macro that only I used. However, the macro is now required to be used by others. The macro opens the required files from my C:\documents and settings\max28052\ etc - the files are automatically named and saved to officers c:\documents and settings\"username"\ after being exported from the corporate database. The file names are always the same regardless of the officer. The only differences in the file path eg. username. Is there a way that I can change the marco to selected the required files from the c:\documents and settings\"username of the logged on user"\help.xls etc. Any help would be greatly appreciated. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hello,
You can use Environ("UserName"). Change you code from ... Workbooks.Open Filename:= _ "C:\Documents and Settings\ksmit40\Desktop\IDCplan.xls" To... Workbooks.Open Filename:= _ "C:\Documents and Settings\" & Environ("UserName") & "\Desktop\IDCplan.xls" -- Kevin Smith :o) "Max2073" wrote: Help needed. I developed a macro that only I used. However, the macro is now required to be used by others. The macro opens the required files from my C:\documents and settings\max28052\ etc - the files are automatically named and saved to officers c:\documents and settings\"username"\ after being exported from the corporate database. The file names are always the same regardless of the officer. The only differences in the file path eg. username. Is there a way that I can change the marco to selected the required files from the c:\documents and settings\"username of the logged on user"\help.xls etc. Any help would be greatly appreciated. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Kevin Smith wrote...
You can use Environ("UserName"). Change you code from ... Workbooks.Open Filename:= _ * * * * "C:\Documents and Settings\ksmit40\Desktop\IDCplan.xls" To... Workbooks.Open Filename:= _ * * * * "C:\Documents and Settings\" & _ Environ("UserName") & "\Desktop\IDCplan.xls" .... Better to use Environ("USERPROFILE") which gives the full profile directory path and won't need to be changed when/if OP's users upgrade to Windows Vista or 7 where profiles are stored under C:\Users rather than C:\Documents and Settings. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
File path | Excel Discussion (Misc queries) | |||
Variabilize File Path or File Name in SumProduct (and Vlookup too) | Excel Worksheet Functions | |||
Formula too long - new file path is shorter than old file path - Excel 2003 | Excel Worksheet Functions | |||
file path | Excel Discussion (Misc queries) | |||
Excel updating from XML file - file path specific? | Excel Discussion (Misc queries) |