largeselection
Active Member
- Joined
- Aug 4, 2008
- Messages
- 358
Hi,
I have some code which creates a connection to a folder at a path I specify in a cell, but I'd like to be able to have others use it on the network drive. The issue is that not everyone has the same Drive letter that I have. I've tried the fix I usually use, but it did not work.
How the path currently appears in my workbook:
E:\MainFolder\Project1
I've tried changing it to:
\\Server\Drive\Mainfolder\Project1
but my code will not create the connection with that. Any ideas on how to fix?
This is the code I use to create the connection:
I have some code which creates a connection to a folder at a path I specify in a cell, but I'd like to be able to have others use it on the network drive. The issue is that not everyone has the same Drive letter that I have. I've tried the fix I usually use, but it did not work.
How the path currently appears in my workbook:
E:\MainFolder\Project1
I've tried changing it to:
\\Server\Drive\Mainfolder\Project1
but my code will not create the connection with that. Any ideas on how to fix?
This is the code I use to create the connection:
Code:
Dim Fpath as String
Fpath = Sheets("MAIN").Range("B12").Value
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array(Array( _
"ODBC;DBQ=" & Fpath & ";DefaultDir=" & Fpath & ";" _
), Array( _
"Driver={Microsoft Text Driver (*.txt; *.csv)};DriverId=27;FIL=text;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransacti" _
), Array("ons=0;Threads=3;UID=admin;UserCommitSync=Yes;")), Destination:=Sheets("QUERY").Range("$A$1")).QueryTable