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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
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,215,614
Messages
6,125,848
Members
449,266
Latest member
davinroach

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