Results 1 to 2 of 2
  1. #1
    SteveApa is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    84

    VBA to automate creation of pivot table in excel

    Hi All.


    I have a database that exports raw data to excel. I want to vba a pivot table from access. I created the vba in excel and am now trying to put it into the database. The VBA works perfectlly when run from excel.. I have no problems putting the data in excel or manipulating it once it is in excel, but when I try to create the pivot table, I get "Invalid procedure call or arguement"...

    All my data from access in excel Sheet1!R1C1:R299C25.

    code cliff notes:
    vba running from access

    Public Sub Do_Pivot_1(xlapp As Object)
    xlapp.ActiveWorkbook.PivotCaches.Create(SourceType :=xlDatabase, SourceData:= _
    "Sheet1!R1C1:R299C25", Version:=xlPivotTableVersion15).CreatePivotTable _
    TableDestination:="Sheet2!R3C1", TableName:="PivotTable1", DefaultVersion _
    :=xlPivotTableVersion15

    again, this code works fine when I run it from a module in excel (of course with out the xlapp.)

    Thanks.

  2. #2
    SteveApa is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    84

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Creating a pivot table in Excel
    By crowegreg in forum Programming
    Replies: 7
    Last Post: 01-20-2014, 08:32 PM
  2. Replies: 8
    Last Post: 07-18-2013, 01:52 PM
  3. Automate Query Creation
    By dr4ke in forum Queries
    Replies: 8
    Last Post: 07-11-2012, 02:39 AM
  4. Pivot table - access to excel
    By antagonia in forum Access
    Replies: 3
    Last Post: 12-16-2011, 01:57 PM
  5. Pivot Table from Excel Spreadsheet
    By Cgil32 in forum Access
    Replies: 0
    Last Post: 08-26-2010, 05:18 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums