View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Greg Greg is offline
external usenet poster
 
Posts: 331
Default Changing path for import file

My macro imports a couple of csv files that are always located in the
c:\users\username\documents\data folder, with username being the user whose
computer the spreadsheet is being used on. Unfortunately for me, whenever I
make a change to the macro, I have to create a separate copy for each
individual so that the file path to the csv file that's being imported is
correct. The portion of the code that refers to the file reads:

With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Users\username\Documents\Data\Import. csv" _
, Destination:=Range("A3"))
.Name = "Import"

Is there a way to code this so I don't have to change the path for each user?

Thanks for any help.