ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom Angle and Alignment with VBA (https://www.excelbanter.com/excel-programming/410481-custom-angle-alignment-vba.html)

baconcow

Custom Angle and Alignment with VBA
 
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

baconcow

Custom Angle and Alignment with VBA
 
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.

"baconcow" wrote:

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



All times are GMT +1. The time now is 09:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com