Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Opening and Naming Files

Ed, I've tried this. It is the ideal solution I'm looking for, but I encoded
the application on Windows 7, and when I transferred it to my Vista Laptop,
I got a runtime error 1004:
'..\Desktop\403.csv' could not be found.

It is on the local desktop. What could be wrong?

Jim


"Ed Ferrero" wrote in message
...
This will work for any user, no need to get the user name

Workbooks.Open Filename:="..\Desktop\403.csv"

But if you really want to manipulate strings

UserName = Range("G5").Value
strPath1 = "C:\Users\"
strPath2 = "\Desktop\403.csv"
strFileNamePath = strPath1 & UserName & strPath2

Workbooks.Open Filename:=strFileNamePath

Ed Ferrero
www.edferrero.com

"Jim Berglund" wrote in message
...
I want to be able to open a file from any users desktop.
From my desktop, the command is
Workbooks.Open Filename:="C:\Users\Jim\Desktop\403.csv"

How do I automate this, using UserName = Range("G5").Value

So that if the user enters 'Dave' into G5, the code line will change to
Workbooks.Open Filename:="C:\Users\Dave\Desktop\403.csv" ?

Thanks, Jim Berglund


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening and Naming Files Chip Pearson Excel Programming 2 May 18th 10 11:47 AM
Naming files Larry Excel Programming 5 April 15th 07 03:28 PM
Creating and Naming a Folder and populating it with files Myles[_78_] Excel Programming 2 August 20th 06 12:29 PM
intersection naming transport between files BorisS Excel Discussion (Misc queries) 0 June 29th 06 08:37 PM
VBA - Looping thro same naming files in 2 directories........PLEASE HELP Manju[_3_] Excel Programming 0 March 10th 06 03:26 PM


All times are GMT +1. The time now is 08:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"