I ran both these sample strings you see in the code below. WizHook reports the "s" string as having a total length in Twips at 9480, which is roughly 6.58 inches. I tested that same string TNR 12pt string in a 5 inch text box and came up with 7198 twips. Maybe I don't have the parameters correct?
Code:
Option Compare Database
Option Explicit
Private Sub testWizhook()
'Declare variables
Dim strCaption As String
Dim strFontName As String
Dim lngSize As Long
Dim lngBreite As Long
Dim lngHoehe As Long
Dim fItalic As Boolean
Dim fUnderline As Boolean
Dim lngWidth As Long
Dim lngHeight As Long
'Take values
strCaption = "Here is a sample text string measured correctly elsewhere"
strCaption = "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss"
strFontName = "Times New Roman "
lngSize = 12
fItalic = False
fUnderline = False
WizHook.Key = 51488399
If WizHook.TwipsFromFont(strFontName, lngSize, lngSize, fItalic, _
fUnderline, 0, strCaption, 0, lngBreite, lngHoehe) = True Then
MsgBox "The specified text has the following dimensions with the selected" & vbCrLf & _
"font attributes:" & vbCrLf & vbCrLf & _
"Width: " & lngBreite & vbCrLf & _
"Height: " & lngHoehe
Else
MsgBox "Calculation failed", vbExclamation
End If
End Sub