PowerPoint tips, hints and tutorials that will change your presentations for ever!



Custom Shows
vba code
Games for teachers
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Set spellcheck language

Home buttonTutorial buttonContact buttonProducts button

PowerPoint cm and Points

Working in the GUI you probably position and size shapes using centimetres (or Inches if you live somewhere that doesn't understand the metric system).

In vba though PowerPoint uses POINTS which can make it difficult to convert.

This function just does the work for you:

Function cm2Points(inVal As Single)
cm2Points = inVal * 28.346
End Function

Example of use:

Sub resize_Me()
With ActiveWindow.Selection.ShapeRange(1)
.Left = cm2Points(3)
.Top = cm2Points(2.2)
End With
End Sub

OK - but we use inches

Function in2Points(inVal As Single)
in2Points = inVal * 72
End Function

Example of use:

Sub resize_Me()
With ActiveWindow.Selection.ShapeRange(1)
.Left = in2Points(1.0)
.Top = in2Points(2.5)
End With
End Sub

Are they using Metric?

In most cases you do not need to know and it is tricky to check. Don't go here if you do not understand API calls!

Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" _
(ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, _
ByVal cchData As Long) As Long

Function GetInfo(ByVal lInfo As Long) As String
Dim Buffer As String
Dim Ret As String
Buffer = String$(256, 0)
Ret = GetLocaleInfo(&H400, lInfo, Buffer, Len(Buffer))
If Ret > 0 Then
If Ret = 1 Then GetInfo = "US" Else GetInfo = "Metric"
GetInfo = "What"
End If
End Function

Sub TestMe()
MsgBox GetInfo(&HD)
End Sub



Back to the Index Page


Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation