Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default PivotTables AddDataField

I'm trying to add a pivot table field using VB Office Tools (I have VB 2007
and Office 2007). In VBA, the command is
ActiveSheet.PivotTables("PivotTable1").AddDataFiel d
ActiveSheet.PivotTables("PivotTable1").PivotFields ("r3 Ret"), "r3 Ret ",
xlAverage

In VB, I can't figure out the equivalent constant for 'xlAverage'. I've
tried using Help but it doesn't describe this very well. What is the
equivalent of VBA's xlAverage in VB?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default PivotTables AddDataField

Hello Ed,

In VB.NET (I assume that you meant VB.NET in VS 2008 by "VB2007"), the
equivalent to xlAverage of VBA is

Microsoft.Office.Interop.Excel.XlConsolidationFunc tion.xlAverage

In case that you meet with similar problems again, here is a tip to find
out the equivalent to VBA:

In VBA project editor of Excel, we right click on the constant "xlAverage",
and choose "Object Browser". In the "Object Browser" window, we input
xlAverage in the search textbox and press the search button. The "Search
Results" box will list the hits of xlAverage:

Library Class Member
Excel XlConsolidationFunction xlAverage

In this way, we will know where the constant is defined:
XlConsolidationFunction. Then in VB.NET, the .NET intelligence can help us
quickly locate the class XlConsolidationFunction and find out the constant:
Microsoft.Office.Interop.Excel.XlConsolidationFunc tion.xlAverage.

Please let me know if you have any other concerns, or need anything else.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default PivotTables AddDataField

Yes, I meant VS 2008.



That is what I was looking for. Thanks for letting me know how to find
other constants. I've always found it frustrating trying to convert a macro
recorded in VBA into VB.Net, especially because the constants are frequently
different. While there is some limited intellisense in VS Office Tools, it
is quite limited.



Ed



""Jialiang Ge [MSFT]"" wrote in message
.. .
Hello Ed,

In VB.NET (I assume that you meant VB.NET in VS 2008 by "VB2007"), the
equivalent to xlAverage of VBA is

Microsoft.Office.Interop.Excel.XlConsolidationFunc tion.xlAverage

In case that you meet with similar problems again, here is a tip to find
out the equivalent to VBA:

In VBA project editor of Excel, we right click on the constant
"xlAverage",
and choose "Object Browser". In the "Object Browser" window, we input
xlAverage in the search textbox and press the search button. The "Search
Results" box will list the hits of xlAverage:

Library Class Member
Excel XlConsolidationFunction xlAverage

In this way, we will know where the constant is defined:
XlConsolidationFunction. Then in VB.NET, the .NET intelligence can help us
quickly locate the class XlConsolidationFunction and find out the
constant:
Microsoft.Office.Interop.Excel.XlConsolidationFunc tion.xlAverage.

Please let me know if you have any other concerns, or need anything else.

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.



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
PivotTables.AddDataField Ed White[_2_] Excel Programming 0 July 22nd 08 12:18 AM
PivotTables Gerry Verschuuren Excel Discussion (Misc queries) 4 October 25th 07 01:12 AM
.AddDataField: is there a similar "replace" data field? PW Excel Programming 0 November 22nd 05 11:53 PM
New to Pivottables- need help coal_miner Charts and Charting in Excel 1 June 6th 05 06:48 PM
PivotTable: AddDataField method Tony G Excel Programming 0 July 16th 03 01:43 PM


All times are GMT +1. The time now is 04:10 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"