Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jo jo is offline
external usenet poster
 
Posts: 5
Default refer to current file name in PivotCaches.Add

I need pass the file name of the open file to the code below where it
says MyCurrentFileName. How do I do this?

I need to create a pivot table based on the data in an open worksheet.
The macro is store in my personal macro area.


ActiveWorkbook.PivotCaches.Add(SourceTy

pe:=xlDatabase, SourceData:= _


"TempSpace!R1C1:R2000C15").CreatePivotT

able TableDestination:= _
"'[MyCurrentFileName.xls]MyPivot'!R1:R65536" _
, TableName:="PivotTable1",

DefaultVersion:=xlPivotTableVersion10

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default refer to current file name in PivotCaches.Add

if it's the active workbook add
Dim aWB as WOrkbook

Set aWB = ActiveWorkbook


TableDestination:= _
"'[" & aWB.name & "]MyPivot'!R1:R65536" _
, TableName:="PivotTable1",


"jo" wrote:

I need pass the file name of the open file to the code below where it
says MyCurrentFileName. How do I do this?

I need to create a pivot table based on the data in an open worksheet.
The macro is store in my personal macro area.


ActiveWorkbook.PivotCaches.Add(SourceTy

pe:=xlDatabase, SourceData:= _


"TempSpace!R1C1:R2000C15").CreatePivotT

able TableDestination:= _
"'[MyCurrentFileName.xls]MyPivot'!R1:R65536" _
, TableName:="PivotTable1",

DefaultVersion:=xlPivotTableVersion10


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refer to current row in formula willemeulen[_12_] Excel Worksheet Functions 5 May 19th 09 03:34 PM
Refer to the worksheet containing the current running code [email protected] Excel Programming 2 November 30th 06 10:14 AM
How refer to current date in Excel SQL query? Ronald S. Cook Excel Programming 3 July 31st 06 08:40 PM
How to refer to current column in a formula? jmg092548 Excel Discussion (Misc queries) 4 August 10th 05 08:00 PM
how to I refer to current workbook without using its name? confused Excel Worksheet Functions 2 June 16th 05 11:50 PM


All times are GMT +1. The time now is 06:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"