Opening Files on other User's Desktops

  • Thread starter Thread starter Jim Berglund
  • Start date Start date
J

Jim Berglund

I may have made an error in judgment by asking this question again, but
having played around with it, I can state the concern properly...

I have created a worksheet which has to run on various user's PC's. It takes
two Do Not Call List area code files, joins them, reformats the data and
then determines if any if the data is also found in data from a reverse
telephone directory, and creates a list of numbers that can be called.

The three data files used are downloaded from the Internet, onto the user's
Desktop. My Excel spreadsheet needs to open the files. The users typically
have Windows 7 or Vista.

I've been told that I can access these files with
Workbooks.Open Filename:="..\Desktop\XXX.csv"

This works on Windows 7 machines, but not on Vista - the only difference in
the software used.

Is there a simple way to fix this?

Jim Berglund
 
use environ("userprofile") to determine the location.

in the vb editor. do a control g to enable the immediate window

paste the following and hit enter

?Environ("UserProfile") & "\Desktop\"

it should give you the desktop location on any pc. then, just add the
filenames, i have no idea if they're hard coded, in cells or what.
 
use environ("userprofile") to determine the location.

in the vb editor. do a control g to enable the immediate window

paste the following and hit enter

?Environ("UserProfile") & "\Desktop\"

it should give you the desktop location on any pc. then, just add the
filenames, i have no idea if they're hard coded, in cells or what.
 
I tried this and got the string for the UserName. Thanks,

My users won't be able to do this - in fact, I don't want them touching the
code. Is there any way I can make this work in a generic way? I've tried all
the suggestions so far, without success.

Jim
 
you need to provide more information. we have no idea what code is needed
because we don't know what you're trying to do.

tell us where you get the filename from. is there going to be a button the
click to open the file? with more info, somebody here can provide you a code
solution to do what you want, it's not that difficult, as long as we get the
information.
 
this code will open the 430.csv file on anybody's desktop, as long as they
haven't modified their user profile:

Workbooks.Open Filename:=environ("Userprofile") & "\Desktop\403.csv"
 
Back
Top