I have a "summary" Excel workbook with pivots and data connections to other "data" workbooks.
Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=C:\Test\Test.xlsm;Mode=Share Deny Write;Extended Properties="HDR=YES;";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Engine Type=37;Jet OLEDB:Database Locking Mode=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 Replica Repair=False;Jet OLEDB:SFP=False;Jet OLEDB:Support Complex Data=False;Jet OLEDB:Bypass UserInfo Validation=False;Jet OLEDB:Limited DB Caching=False;Jet OLEDB:Bypass ChoiceField Validation=False
I'm refreshing using VBA ActiveWorkbook.Connections("Test.xlsm").Refresh
.
Is there a way in VBA to tell Excel to drop the access so the data workbook becomes free. The only solution I can think of is to shut down the workbook and open again.
ok I found a solution and hopefully it will help someone else in the future.
I'll deal with the 2nd problem first!
Dim conn As Variant
For Each conn In ActiveWorkbook.Connections
conn.OLEDBConnection.MaintainConnection = False
Next conn
So in excel 2013 I discovered the maintain connection property is set the true by default. This sets it to false after I have refreshed the data connections. Works a treat and now the user can go into the source data after my refresh with no problems at all.
Many thanks!