Fake a Drive and Path (Dev versus Prod)?

drewg

Board Regular
Joined
Jul 5, 2010
Messages
67
Hi
This must be an ancient problem but Im stumped
A workbook copies a range into an Access table, but the problem is
Where it was written, the Access database is on C:\Data\MyApp
Where it is running, the Access database is on R:\MRXX\Prod\Colby
Is it possible to fake it somehow so that we pick up the right path regardless of where its running?
Thanks very much
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You would want to replace the C:\ and R:\ in this example with the full path to where the Excel sheet would be stored at.

Perhaps something like this:

Code:
Dim accessPath As String
Select Case ThisWorkbook.Path
    Case "C:\": accessPath = "C:\Data\MyApp\"
    Case "R:\": accessPath = "R:\MRXX\Prod\Colby\"
End Select
 
Last edited:
Upvote 0
Thanks very much
The Excel workbooks are always in C:\ProjectDir in either situation, its the Access location that changes, so the C:\ branch will always win.
In the interim i found this
Code:
If Len(Dir("c:\Instructions.doc")) = 0 Then
   Msgbox "This file does NOT exist."
Else
   Msgbox "This file does exist."
End If
So thanks very much for your help, I appreciate it
 
Upvote 0

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top