Custom Angle and Alignment with VBA

B

baconcow

In Excel, I am using VBA to create charts. However, I have not figured out
how to use them quite as in-depth. One of the things I cannot recreate is the
following function:

When I click on an axis and go to "Format Axis" and then click
on"Alignment", I can then change the "Text layout".

I want VBA to change it to
Vertical alignment "Middle Centered" (default),
Text direction "Horizontal" (default)
Custom angle "60 degrees" (not default)

Whenever I record a macro and change the custom angle, it never shows up in
the code. Is there a way to do this with VBA? Thanks
 
B

baconcow

Pouring through the different ticklabel objects, I finally found the proper
one:

ch111.Axes(xlCategory, xlPrimary).TickLabels.Orientation = 60

(you need to use +60 if you want an angle of -60, don't know why... and -60
for an angle of +60)

Hope this helps somebody who needs it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top