Excel VBA to change ODC Connection Files

JadeEyes5x5

New Member
Joined
May 11, 2018
Messages
1
I've looked for three days and tried several solutions that were close but I'm still at zero progress.
REQUEST:
I exported the ODC Connection Files that point to my Dev and Prod SharePoint sites and uploaded the files to a SupportFiles Document Library the Workbook has access to. Right now, I have to manually change the ODC files as noted below but I' want VBA to do an IF and change them for me depending upon a var I labeled 'RequestSite'.

CURRENT:
If Request is from Production site, user deletes ODC File #1 and replace with ODC File # 3 (using the old file #1 naming convention) then opens the macro workbook.
If Request is from Development site, user deletes ODC file #1 and replace with ODC File # 2 (using the old file #1 naming convention) then opens the macro workbook.
NOTE: the Development and Production sites are exact mirrors of each other, other than the URLs

DESIRE VBA Solution that does something like:
If RequestSite = Prod then
Change ODC Connection file to File #3
Else
Change ODC Connection file to File #2
End If

ODC Files:

  1. https://.../SupportFiles/ceafAListTableFile.odc
  2. https://.../SupportFiles/ceafAListTableDevFile.odc
  3. https://.../SupportFiles/ceafAListTableProdFile.odc

I'm not sure what other info needs to change or I need to include here to help you provide a solution for me?
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,103
Messages
6,170,123
Members
452,303
Latest member
c4cstore

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