How to get shape dimensions for VBA code?

G

Gregg

How do I convert native dialog box dimensions for formatting to VBA
dimensions for use in code?

I'm trying to write code that will adjust the position and size of a
title placeholder on a title slide. I've got a good start, but I can't
figure out the dimension units VBA wants.

For example, in the format dialog box, I want the width to be 9, but it
records as ".Width = 647.75". I want the vertical position to be 5.28
from top left corner, but it records as ".Top = 380#" .

So, I need to put dimensions into this code, but don't know what the
VBA equation to convert the dialog box numbers:

Sub Dims1Title()
Dim slSlide As Slide
For Each slSlide In ActiveWindow.Selection.SlideRange
If slSlide.Shapes.HasTitle Then
With slSlide.Shapes.Title
.Height = ??
.Width = ??
.Left = ??
.Top = ??
.TextFrame.TextRange.Font.Name = "times new roman"
.TextFrame.TextRange.Font.Size = "18"
End With
End If
Next slSlide
End Sub
 
S

Shyam Pillai

Gregg,
The dialog box displays the dimensions in inches while the code uses Points
as the unit of measurement.
1 inch = 72 points.
 

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