Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default ONe Macro won't call another

Hi All.........
I'm having a heck of a time with Excel97,SR2.

I have a macro which runs a MSQuery and returns data to my Excel sheet from
an outside database. It works fine when run by itself.

I have another macro which runs a Pivot Table on that data. It works fine
when run by itself.

When I try to call the second macro from the first, I get error message "Run
time error '1004', AddFields method of Pivot Table class failed". Yet each
macro will run individually and the whole thing will run if stepped through
from the beginning by hand. This combination of macros is for retrieving
Materials Data. I have another pair, very nearly the same which retireve
Labor Data and they run together just fine.

I've tried changing the name of the called macro, and using both "Call
PivotMaterials" and "Application.run "PivotMaterials"".....no difference.

Any help would be much appreciated...

Vaya con Dios,
Chuck, CABGx3








  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default ONe Macro won't call another

when you refresh the querytable, do you have the backgroundquery parameter
set to false?

--
Regards,
Tom Ogilvy


"CLR" wrote:

Hi All.........
I'm having a heck of a time with Excel97,SR2.

I have a macro which runs a MSQuery and returns data to my Excel sheet from
an outside database. It works fine when run by itself.

I have another macro which runs a Pivot Table on that data. It works fine
when run by itself.

When I try to call the second macro from the first, I get error message "Run
time error '1004', AddFields method of Pivot Table class failed". Yet each
macro will run individually and the whole thing will run if stepped through
from the beginning by hand. This combination of macros is for retrieving
Materials Data. I have another pair, very nearly the same which retireve
Labor Data and they run together just fine.

I've tried changing the name of the called macro, and using both "Call
PivotMaterials" and "Application.run "PivotMaterials"".....no difference.

Any help would be much appreciated...

Vaya con Dios,
Chuck, CABGx3








  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default ONe Macro won't call another

I don't know if this will change anything, but have you tried just:

PivotMaterials

No Call or Application.Run.


"CLR" wrote in message
...
Hi All.........
I'm having a heck of a time with Excel97,SR2.

I have a macro which runs a MSQuery and returns data to my Excel sheet
from
an outside database. It works fine when run by itself.

I have another macro which runs a Pivot Table on that data. It works fine
when run by itself.

When I try to call the second macro from the first, I get error message
"Run
time error '1004', AddFields method of Pivot Table class failed". Yet
each
macro will run individually and the whole thing will run if stepped
through
from the beginning by hand. This combination of macros is for retrieving
Materials Data. I have another pair, very nearly the same which retireve
Labor Data and they run together just fine.

I've tried changing the name of the called macro, and using both "Call
PivotMaterials" and "Application.run "PivotMaterials"".....no difference.

Any help would be much appreciated...

Vaya con Dios,
Chuck, CABGx3










  #4   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default ONe Macro won't call another

Thanks Tom, that did the trick!!!!! You're a miracle-worker. The "good"
pair was set to false, the one that didn't work was set to true. Re-setting
it to false solved the problem. Thanking you very very much, kind Sir.

Vaya con Dios,
Chuck, CABGx3




"Tom Ogilvy" wrote:

when you refresh the querytable, do you have the backgroundquery parameter
set to false?

--
Regards,
Tom Ogilvy


"CLR" wrote:

Hi All.........
I'm having a heck of a time with Excel97,SR2.

I have a macro which runs a MSQuery and returns data to my Excel sheet from
an outside database. It works fine when run by itself.

I have another macro which runs a Pivot Table on that data. It works fine
when run by itself.

When I try to call the second macro from the first, I get error message "Run
time error '1004', AddFields method of Pivot Table class failed". Yet each
macro will run individually and the whole thing will run if stepped through
from the beginning by hand. This combination of macros is for retrieving
Materials Data. I have another pair, very nearly the same which retireve
Labor Data and they run together just fine.

I've tried changing the name of the called macro, and using both "Call
PivotMaterials" and "Application.run "PivotMaterials"".....no difference.

Any help would be much appreciated...

Vaya con Dios,
Chuck, CABGx3








  #5   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default ONe Macro won't call another

Thanks for the thought PCLIVE, but Tom just hit the nail on the
head.......problem solved.

Vaya con Dios,
Chuck, CABGx3



"PCLIVE" wrote:

I don't know if this will change anything, but have you tried just:

PivotMaterials

No Call or Application.Run.


"CLR" wrote in message
...
Hi All.........
I'm having a heck of a time with Excel97,SR2.

I have a macro which runs a MSQuery and returns data to my Excel sheet
from
an outside database. It works fine when run by itself.

I have another macro which runs a Pivot Table on that data. It works fine
when run by itself.

When I try to call the second macro from the first, I get error message
"Run
time error '1004', AddFields method of Pivot Table class failed". Yet
each
macro will run individually and the whole thing will run if stepped
through
from the beginning by hand. This combination of macros is for retrieving
Materials Data. I have another pair, very nearly the same which retireve
Labor Data and they run together just fine.

I've tried changing the name of the called macro, and using both "Call
PivotMaterials" and "Application.run "PivotMaterials"".....no difference.

Any help would be much appreciated...

Vaya con Dios,
Chuck, CABGx3











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
How can run a macro ( call a macro) on selection of any filtercriteria? [email protected] Excel Worksheet Functions 7 February 20th 09 12:34 AM
Call an Access macro from an Excel macro Jason W Excel Discussion (Misc queries) 1 May 1st 08 08:33 PM
Excel Macro call Word Macro with Parameters Bill Sturdevant[_2_] Excel Programming 9 May 24th 07 12:21 AM
macro call Steve Excel Discussion (Misc queries) 12 August 25th 06 04:27 AM
Call another Macro Sandy Excel Programming 4 January 11th 05 04:06 PM


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

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"