View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] ONeill.Elizabeth@gmail.com is offline
external usenet poster
 
Posts: 1
Default PivotTables and Changing the FileName

Hello,

I'm hoping someone can provide me with a little help.

I've created a button in excel that automatically generates a pviot
table for the user. The problem is that they'll likely save it with a
different file name (they'll want a new version every 2 months or so)
and the pivot table is linked to the file name and if you change the
file name the button won't work.

Is there anyway I can make the filename dynamic and change
automatically when the file is saved with a new name?

Thanks,
Liz

code:
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"primary_1d").CreatePivotTable TableDestination:= _
"'[rollup ver 10.xls]Revenues by Client Chart'!R7C2",
TableName:="PivotTable3", DefaultVersion:=xlPivotTableVersion10