Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I would like to create a macro (to be executed with a button) which sets the property "Max Visible Number" in the upper right corner of the Presentation Tab in the options of a bar diagram, on e.g. 10 or x+5 or something like that. Unfortunately I can't find specific information in the API Guide. Has perhaps someone experience with that? Thanks a lot in advance, Martin
Hi,
I got the solution.
Try this.
set chart = ActiveDocument.Sheets("Main").CreateBarChart
chart.AddDimension "F1"
chart.AddExpression "count(F1)"
set cp = chart.GetProperties
set dims = cp.Dimensions
dims(0).MaxNumShown.v = 10
chart.SetProperties cp
Regards,
Kaushik Solanki
Hi,
Here is the code from API guide to set the maximum visible number.
set chart = ActiveDocument.Activesheet.CreatePivotTable
chart.AddDimension "ProductType"
chart.AddExpression "sum(Amount)"
chart.AddExpression "count(Customer)"
set cp = chart.GetProperties
set dims = cp.Dimensions
dims(0).MaxNumShown = 10
chart.SetProperties cp
This will set the value to 10 for the dimension "ProductType"
and that is specified by this line
dims(0).MaxNumShown = 10
Hope this will help you
Regards,
Kaushik Solanki
Hi, thanks a lot for your help. I tried it but when I click the button it shows me this:
The text means something like "Wrong number of arguments or invalid property assignment".
Where is my mistake?
Thanks,
Martin
PS: Is there some kind of overview somewhere which shows me information like this one? (e.g. the fact that this property is called MaxNumShown)
Hi,
Can you please translate the error you got at the top in english.
Regards,
Kaushik Solanki
Hi,
I did, below the image. 🙂
This is what google-translation says:
"Wrong number of arguments or invalid property assignment: 'dims (...). MaxNumShown'"
Regards,
Martin
Hi,
Can you tell me what are the dimension you have specified in your charts.
Regards,
Kaushik Solanki
Hi,
I have just a simple example with one dimension "Firma" (Account):
Regards,
Martin
Hi,
I checked, but the code given in API is not working.
Sorry, i am working on this. Will let you know if i get any solution on this.
Regards,
Kaushik Solanki
I think the problem is you are giving a number for a string parameter, try with
dims(0).MaxNumShown = "10"
Hi,
I got the solution.
Try this.
set chart = ActiveDocument.Sheets("Main").CreateBarChart
chart.AddDimension "F1"
chart.AddExpression "count(F1)"
set cp = chart.GetProperties
set dims = cp.Dimensions
dims(0).MaxNumShown.v = 10
chart.SetProperties cp
Regards,
Kaushik Solanki