Link to home
Start Free TrialLog in
Avatar of AndyAinscow
AndyAinscowFlag for Switzerland

asked on

Chart on powerpoint slide - formatting changes after data is filled in.

On the attached image one sees that the top left chart has a 'standard' number format for the axis wheras the bottom right has a 'scientific' format.
Initially both charts had the 'standard' number format for the labels.  After filling the dataset for the chart with VBA code running in Microsoft Access (no changes to formatting, only the numbers to be displayed) the one chart is OK but the other has been changed to 'scientific' format which is unwanted.

Why is this happening?
More important - how can I set the axis tick lables formatting back to 'standard' via VBA code?
Avatar of Rgonzo1971
Rgonzo1971

No File
HI,

Maybe

    ActiveChart.Axes(xlCategory).TickLabels.NumberFormat = "0"
    ActiveChart.Axes(xlValue).TickLabels.NumberFormat = "0"

Regards
Avatar of AndyAinscow

ASKER

Aaagh, here is the image.

User generated image
Thanks.  That just displays without any decimal point.
ActiveChart.Axes(xlCategory).TickLabels.NumberFormat = "0.0"
ActiveChart.Axes(xlValue).TickLabels.NumberFormat = "0.0"
Getting closer.
The 0.0 isn't suitable as some axes then just show each tick label as zero however .NumberFormat = "0.####" is rather closer.
User generated imageHowever that now leaves an ugly '.' when the labels are all integer - see the 'BUT' graphs
then try this format

"[>=1]0;[=0]0;0.######"

Regards
That cures that but then promptly brings another:
User generated imageWhere the axis now has two lables both of 2 with the custom format
User generated image

What I want (which is how the empty chart is formatted) results in
User generated imageusing the 'standard' setting for the label format
User generated image

For some reason this setting is being replaced on some, but not all, charts after I fill the values into the dataset.
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'd tried 'Standard' before asking the question - it barfed.  Now with 'General' it works perfectly.
Thanks.
General in English

ActiveChart.Axes(xlCategory).TickLabels.NumberFormatLocal = "Standard"
Unfortunately Standard is also an English word with an similar meaning in this context.  Anyway it works now.  :-)