source data for pivot

ericlch16

Active Member
Joined
Nov 2, 2007
Messages
311
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
option 1
sourcedatastring = '\\myunc\_WT_.xls'!$A$1:$CI$65536

option 2
sourcedatastring = 'L:\_WT_.xls'!$A$1:$CI$65536

using VBA i do this:-

pvtTable.SourceData = sourcedatastring


only option 2 works.. when i put a UNC drive as a sourcedata the pivot does not like it.. why? is there anyway i can solve that?

I need to put a UNC location as source data in pivottable in VBA but how?

any help?
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
If you put the book name in brackets and add the sheet name it seems to work. (at least in xl2007)

sourcedatastring = '\\myunc\[_WT_.xls]Sheet1'!$A$1:$CI$65536

Even though the drive letter syntax allows you to omit the sheet name, it's probably best to be explicit in your VBA code.
 
Upvote 0

Forum statistics

Threads
1,222,118
Messages
6,164,066
Members
451,870
Latest member
Nikhil excel

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