Variable Path for External Pivot Database

Carvahall

New Member
Joined
Jun 16, 2015
Messages
1
Hi there,

For my work, I'm creating a PivotTable, which consists gets the data from an external mdb-File. Because the Path of this file should be able to be changed by a VBA script, i would like to create a script, that takes part of the Filepath from a Cell and creates out of that the new path of the mdb file (they all are stored in a Way that this will work out)

Here is now my Script:

Code:
"OLEDB;Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source="C:\Folder" & FolderString & "File.mdb";Mode=Share Deny Write;Exten" _
        , _
        "ded Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mod" _
        , _
        "e=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="""";Jet OLEDB:Create" _
        , _
        " System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without R" _
        , "eplica Repair=False;Jet OLEDB:SFP=False;Jet OLEDB:Support Complex Data=False" _
        )
        .RefreshOnFileOpen = False
        .SavePassword = False
        .SourceConnectionFile = ""
        .ServerCredentialsMethod = xlCredentialsMethodIntegrated
        .AlwaysUseConnectionFile = False

The Problem is, that the name of the string gets mistaken as Text. How can i change that?

Thanks in advance
Carvahall
 

Some videos you may like

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Watch MrExcel Video

Forum statistics

Threads
1,122,514
Messages
5,596,612
Members
414,080
Latest member
penguin23

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
Top