View Single Post
 
Old 08-27-2012, 01:51 AM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,913
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

PowerPoint doesn't have an ACos function (unlike Excel) which makes it difficult to get the Angle from a Cosine

You can write a User defined function though (hope your math is good!).

Code:
Function GetAngle(ThisCos As Double) As Double
Const PI As Double = 3.141592
Dim Acos As Double
Acos = Atn(-ThisCos / Sqr(-ThisCos * ThisCos + 1)) + 2 * Atn(1)
GetAngle = Round(Acos * 180 / PI, 2)
End Function
From your normal code you would use this :

Code:
Dim theAngle As Double
theAngle = GetAngle(0.866)
MsgBox theAngle
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote