Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
userid in macro
I have a macro that opens a file on my desktop and references the full
pathname including my id. Is there a way to convert this so that anyone can use it? example: Workbooks.OpenText Filename:= "C:\Documents and Settings\myid\Desktop\assys.txt",... We all will have the same pathname with the exception of "myid" Thanks for your help, Mary Ann |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
userid in macro
in the vb editor, type the following in the immediate pane and press enter (if
it's not visible, hit control-G or click on view then immediate window) ?environ("userprofile") -- Gary "mmccoog" wrote in message ... I have a macro that opens a file on my desktop and references the full pathname including my id. Is there a way to convert this so that anyone can use it? example: Workbooks.OpenText Filename:= "C:\Documents and Settings\myid\Desktop\assys.txt",... We all will have the same pathname with the exception of "myid" Thanks for your help, Mary Ann |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
userid in macro
sorry hit send too fast
Workbooks.OpenText Filename:=(Environ("userprofile") & "\Desktop\assys.txt") -- Gary "mmccoog" wrote in message ... I have a macro that opens a file on my desktop and references the full pathname including my id. Is there a way to convert this so that anyone can use it? example: Workbooks.OpenText Filename:= "C:\Documents and Settings\myid\Desktop\assys.txt",... We all will have the same pathname with the exception of "myid" Thanks for your help, Mary Ann |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
userid in macro
That worked! Thanks Gary.
"Gary Keramidas" wrote: sorry hit send too fast Workbooks.OpenText Filename:=(Environ("userprofile") & "\Desktop\assys.txt") -- Gary "mmccoog" wrote in message ... I have a macro that opens a file on my desktop and references the full pathname including my id. Is there a way to convert this so that anyone can use it? example: Workbooks.OpenText Filename:= "C:\Documents and Settings\myid\Desktop\assys.txt",... We all will have the same pathname with the exception of "myid" Thanks for your help, Mary Ann |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
userid in macro
Try:-
UserProfileFolder = Environ("UserProfile") To return the user-profile and incorporate the variable into the path Workbooks.OpenText Filename:= "C:\Documents and Settings\" & UserProfileFolder &" myid\Desktop\assys.txt",.. Mike "mmccoog" wrote: I have a macro that opens a file on my desktop and references the full pathname including my id. Is there a way to convert this so that anyone can use it? example: Workbooks.OpenText Filename:= "C:\Documents and Settings\myid\Desktop\assys.txt",... We all will have the same pathname with the exception of "myid" Thanks for your help, Mary Ann |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
userid in macro
Mike,
I'm getting an error on this format: Run-time error '1004': Method "OpenText' of object 'Workbooks' failed Here's what I tried: UserProfileFolder = Environ("UserProfile") Workbooks.OpenText Filename:="C:\Documents and Settings\" & UserProfileFolder & " \Desktop\assys.txt", ... "Mike H" wrote: Try:- UserProfileFolder = Environ("UserProfile") To return the user-profile and incorporate the variable into the path Workbooks.OpenText Filename:= "C:\Documents and Settings\" & UserProfileFolder &" myid\Desktop\assys.txt",.. Mike "mmccoog" wrote: I have a macro that opens a file on my desktop and references the full pathname including my id. Is there a way to convert this so that anyone can use it? example: Workbooks.OpenText Filename:= "C:\Documents and Settings\myid\Desktop\assys.txt",... We all will have the same pathname with the exception of "myid" Thanks for your help, Mary Ann |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userid | Excel Programming | |||
How can I get network userid in a cell in excel? | Excel Programming | |||
Log UserID | Excel Programming | |||
DSN UserId and Password Prompt | Excel Programming | |||
DSN UserId and Password Prompt | Excel Programming |