PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.

CreatePivotTable: Invalid procedure call or argument

 
 
=?Utf-8?B?RGVzZXJ0Q3ljbGlzdA==?=
Guest
Posts: n/a
 
      29th Oct 2007
The following code is returning an "Invalid procedure call or argument" error
on the ".CreatePivotTable" line. It works on one machine but not on another!
Both machines have the WhoDidWhatWhen workbook, and the workbook contains a
sheet called "Pivot" (on both machines). I'm stumped. Thank you for your help.

====

With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
.Connection = Array(Array( _
"ODBC;DSN=MS Access Database;DBQ=\\cpsa-fs\fa$\Financial
Analysis\ProjectTime.mdb;DefaultDir=\\cpsa-fs\fa$\Financial
Analysis;DriverId=25;FIL=MS Access;MaxBuff" _
), Array("erSize=2048;PageTimeout=5;"))
.CommandType = xlCmdSql
.CommandText = Array( _
"SELECT tblTimeReported.computername, tblTimeReported.project,
tblTimeReported.startday, tblTimeReported.timespent" & Chr(13) & "" & Chr(10)
& "FROM `\\cpsa-fs\fa$\Financial Analysis\ProjectTime`.tblTimeReported
tblTimeReported" & Chr(13) & "" & Chr(10) & "WHERE (tblT" _
, _
"imeReported" & strWorker & ") AND (tblTimeReported.startday>={ts '"
& strStart & " 00:00:00'}) AND (tblTimeReported.startday < {ts '" & strEnd &
" 00:00:00'})AND (tblTimeReported.timespent>0)" _
)
.CreatePivotTable TableDestination:="[whodidwhatwhen]pivot!R8C1",
TableName:= _
"PivotTable2", , DefaultVersion:=xlPivotTableVersion10
End With

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      29th Oct 2007
Different versions of XL??? "xlPivotTableVersion10" The Pivot table engine
changed in 2002 and pre/post versions are not compatble.
--
HTH...

Jim Thomlinson


"DesertCyclist" wrote:

> The following code is returning an "Invalid procedure call or argument" error
> on the ".CreatePivotTable" line. It works on one machine but not on another!
> Both machines have the WhoDidWhatWhen workbook, and the workbook contains a
> sheet called "Pivot" (on both machines). I'm stumped. Thank you for your help.
>
> ====
>
> With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
> .Connection = Array(Array( _
> "ODBC;DSN=MS Access Database;DBQ=\\cpsa-fs\fa$\Financial
> Analysis\ProjectTime.mdb;DefaultDir=\\cpsa-fs\fa$\Financial
> Analysis;DriverId=25;FIL=MS Access;MaxBuff" _
> ), Array("erSize=2048;PageTimeout=5;"))
> .CommandType = xlCmdSql
> .CommandText = Array( _
> "SELECT tblTimeReported.computername, tblTimeReported.project,
> tblTimeReported.startday, tblTimeReported.timespent" & Chr(13) & "" & Chr(10)
> & "FROM `\\cpsa-fs\fa$\Financial Analysis\ProjectTime`.tblTimeReported
> tblTimeReported" & Chr(13) & "" & Chr(10) & "WHERE (tblT" _
> , _
> "imeReported" & strWorker & ") AND (tblTimeReported.startday>={ts '"
> & strStart & " 00:00:00'}) AND (tblTimeReported.startday < {ts '" & strEnd &
> " 00:00:00'})AND (tblTimeReported.timespent>0)" _
> )
> .CreatePivotTable TableDestination:="[whodidwhatwhen]pivot!R8C1",
> TableName:= _
> "PivotTable2", , DefaultVersion:=xlPivotTableVersion10
> End With
>

 
Reply With Quote
 
=?Utf-8?B?RGVzZXJ0Q3ljbGlzdA==?=
Guest
Posts: n/a
 
      29th Oct 2007
Thanks for the reply, Jim. Unfortunately, both versions are the same (2003,
SP2).

"Jim Thomlinson" wrote:

> Different versions of XL??? "xlPivotTableVersion10" The Pivot table engine
> changed in 2002 and pre/post versions are not compatble.
> --
> HTH...
>
> Jim Thomlinson
>
>
> "DesertCyclist" wrote:
>
> > The following code is returning an "Invalid procedure call or argument" error
> > on the ".CreatePivotTable" line. It works on one machine but not on another!
> > Both machines have the WhoDidWhatWhen workbook, and the workbook contains a
> > sheet called "Pivot" (on both machines). I'm stumped. Thank you for your help.
> >
> > ====
> >
> > With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
> > .Connection = Array(Array( _
> > "ODBC;DSN=MS Access Database;DBQ=\\cpsa-fs\fa$\Financial
> > Analysis\ProjectTime.mdb;DefaultDir=\\cpsa-fs\fa$\Financial
> > Analysis;DriverId=25;FIL=MS Access;MaxBuff" _
> > ), Array("erSize=2048;PageTimeout=5;"))
> > .CommandType = xlCmdSql
> > .CommandText = Array( _
> > "SELECT tblTimeReported.computername, tblTimeReported.project,
> > tblTimeReported.startday, tblTimeReported.timespent" & Chr(13) & "" & Chr(10)
> > & "FROM `\\cpsa-fs\fa$\Financial Analysis\ProjectTime`.tblTimeReported
> > tblTimeReported" & Chr(13) & "" & Chr(10) & "WHERE (tblT" _
> > , _
> > "imeReported" & strWorker & ") AND (tblTimeReported.startday>={ts '"
> > & strStart & " 00:00:00'}) AND (tblTimeReported.startday < {ts '" & strEnd &
> > " 00:00:00'})AND (tblTimeReported.timespent>0)" _
> > )
> > .CreatePivotTable TableDestination:="[whodidwhatwhen]pivot!R8C1",
> > TableName:= _
> > "PivotTable2", , DefaultVersion:=xlPivotTableVersion10
> > End With
> >

 
Reply With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      29th Oct 2007
Any problem with data access to \\cpsa-fs\fa$\Financial Analysis\ProjectTime???
--
HTH...

Jim Thomlinson


"DesertCyclist" wrote:

> Thanks for the reply, Jim. Unfortunately, both versions are the same (2003,
> SP2).
>
> "Jim Thomlinson" wrote:
>
> > Different versions of XL??? "xlPivotTableVersion10" The Pivot table engine
> > changed in 2002 and pre/post versions are not compatble.
> > --
> > HTH...
> >
> > Jim Thomlinson
> >
> >
> > "DesertCyclist" wrote:
> >
> > > The following code is returning an "Invalid procedure call or argument" error
> > > on the ".CreatePivotTable" line. It works on one machine but not on another!
> > > Both machines have the WhoDidWhatWhen workbook, and the workbook contains a
> > > sheet called "Pivot" (on both machines). I'm stumped. Thank you for your help.
> > >
> > > ====
> > >
> > > With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
> > > .Connection = Array(Array( _
> > > "ODBC;DSN=MS Access Database;DBQ=\\cpsa-fs\fa$\Financial
> > > Analysis\ProjectTime.mdb;DefaultDir=\\cpsa-fs\fa$\Financial
> > > Analysis;DriverId=25;FIL=MS Access;MaxBuff" _
> > > ), Array("erSize=2048;PageTimeout=5;"))
> > > .CommandType = xlCmdSql
> > > .CommandText = Array( _
> > > "SELECT tblTimeReported.computername, tblTimeReported.project,
> > > tblTimeReported.startday, tblTimeReported.timespent" & Chr(13) & "" & Chr(10)
> > > & "FROM `\\cpsa-fs\fa$\Financial Analysis\ProjectTime`.tblTimeReported
> > > tblTimeReported" & Chr(13) & "" & Chr(10) & "WHERE (tblT" _
> > > , _
> > > "imeReported" & strWorker & ") AND (tblTimeReported.startday>={ts '"
> > > & strStart & " 00:00:00'}) AND (tblTimeReported.startday < {ts '" & strEnd &
> > > " 00:00:00'})AND (tblTimeReported.timespent>0)" _
> > > )
> > > .CreatePivotTable TableDestination:="[whodidwhatwhen]pivot!R8C1",
> > > TableName:= _
> > > "PivotTable2", , DefaultVersion:=xlPivotTableVersion10
> > > End With
> > >

 
Reply With Quote
 
Scott Gall
Guest
Posts: n/a
 
      15th Oct 2010
I just ran accross a similar issue myslef...

try:

..CreatePivotTable TableDestination:="[whodidwhatwhen.xls]pivot!R8C1",
TableName:= _

insdead of

..CreatePivotTable TableDestination:="[whodidwhatwhen]pivot!R8C1",
TableName:= _


> On Monday, October 29, 2007 2:14 PM DesertCyclis wrote:


> The following code is returning an "Invalid procedure call or argument" error
> on the ".CreatePivotTable" line. It works on one machine but not on another!
> Both machines have the WhoDidWhatWhen workbook, and the workbook contains a
> sheet called "Pivot" (on both machines). I'm stumped. Thank you for your help.
>
> ====
>
> With ActiveWorkbook.PivotCaches.Add(SourceType:=xlExternal)
> .Connection = Array(Array( _
> "ODBC;DSN=MS Access Database;DBQ=\\cpsa-fs\fa$\Financial
> Analysis\ProjectTime.mdb;DefaultDir=\\cpsa-fs\fa$\Financial
> Analysis;DriverId=25;FIL=MS Access;MaxBuff" _
> ), Array("erSize=2048;PageTimeout=5;"))
> .CommandType = xlCmdSql
> .CommandText = Array( _
> "SELECT tblTimeReported.computername, tblTimeReported.project,
> tblTimeReported.startday, tblTimeReported.timespent" & Chr(13) & "" & Chr(10)
> & "FROM `\\cpsa-fs\fa$\Financial Analysis\ProjectTime`.tblTimeReported
> tblTimeReported" & Chr(13) & "" & Chr(10) & "WHERE (tblT" _
> , _
> "imeReported" & strWorker & ") AND (tblTimeReported.startday>={ts '"
> & strStart & " 00:00:00'}) AND (tblTimeReported.startday < {ts '" & strEnd &
> " 00:00:00'})AND (tblTimeReported.timespent>0)" _
> )
> .CreatePivotTable TableDestination:="[whodidwhatwhen]pivot!R8C1",
> TableName:= _
> "PivotTable2", , DefaultVersion:=xlPivotTableVersion10
> End With



>> On Monday, October 29, 2007 2:18 PM James_Thomlinso wrote:


>> Different versions of XL??? "xlPivotTableVersion10" The Pivot table engine
>> changed in 2002 and pre/post versions are not compatble.
>> --
>> HTH...
>>
>> Jim Thomlinson
>>
>>
>> "DesertCyclist" wrote:



>>> On Monday, October 29, 2007 2:35 PM DesertCyclis wrote:


>>> Thanks for the reply, Jim. Unfortunately, both versions are the same (2003,
>>> SP2).
>>>
>>> "Jim Thomlinson" wrote:



>>>> On Monday, October 29, 2007 4:01 PM James_Thomlinso wrote:


>>>> Any problem with data access to \\cpsa-fs\fa$\Financial Analysis\ProjectTime???
>>>> --
>>>> HTH...
>>>>
>>>> Jim Thomlinson
>>>>
>>>>
>>>> "DesertCyclist" wrote:



>>>> Submitted via EggHeadCafe - Software Developer Portal of Choice
>>>> FireAndForget Asynchronous Utility Class for SQL Server Inserts and Updates
>>>> http://www.eggheadcafe.com/tutorials...d-updates.aspx

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Invalid procedure call or argument. Philosophaie Microsoft Excel Programming 3 23rd Sep 2009 11:45 PM
Invalid procedure call or argument salgud Microsoft Excel Programming 1 12th Jan 2009 10:41 PM
Re: Invalid procedure call or argument JE McGimpsey Microsoft Excel Programming 0 12th Jan 2009 09:38 PM
Invalid Procedure Call or Argument Jim Windows XP Help 3 4th Aug 2004 03:47 PM
Invalid procedure call or argument!!! Kim Microsoft Access Form Coding 0 5th Sep 2003 01:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:45 AM.