Centering Text using Stephen Lebans code

G

Guest

Hi

I have a report with 4 text boxes called; ComfortZone, WorryZone,
CelebrationZone, DangerZone that I want to centre vertically.

Using Stephen's code I have set an event procedure on the Report Detail; On
format as per the following [though when I try to open the report it comes
back with a compile error and I'm not quite sure what to do]:


' Copyright Lebans Holdings 1999 Ltd.
' www.lebans.com
' Please note this method will always be off
' by one pixel due to rounding.
' Vertical Justification is performed in the same manner
' as Excel. We are trying to center the Top of a capital
' character and the bottom(baseline) of the capital character.
' If you look in the Reports section on my web site you will
' find code that uses the ascending and descending char values
' to calculate a more accurate vertical justification.


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' You have to call the function every time
' during the Report's Detail Format event.
VerticallyCenter Me.ComfortZone
VerticallyCenter Me.CelebrationZone
VerticallyCenter Me.WorryZone
VerticallyCenter Me.DangerZone
End Sub

TIA for any assistance --

Sue Compelling
 
D

Douglas J. Steele

Try compiling your code (under Debug when you're in the VB Editor). It
should highlight what's causing it problems.
 
G

Guest

Thanks Doug - just had to work through this methodically.
--
Sue Compelling


Douglas J. Steele said:
Try compiling your code (under Debug when you're in the VB Editor). It
should highlight what's causing it problems.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Sue Compelling said:
Hi

I have a report with 4 text boxes called; ComfortZone, WorryZone,
CelebrationZone, DangerZone that I want to centre vertically.

Using Stephen's code I have set an event procedure on the Report Detail;
On
format as per the following [though when I try to open the report it comes
back with a compile error and I'm not quite sure what to do]:


' Copyright Lebans Holdings 1999 Ltd.
' www.lebans.com
' Please note this method will always be off
' by one pixel due to rounding.
' Vertical Justification is performed in the same manner
' as Excel. We are trying to center the Top of a capital
' character and the bottom(baseline) of the capital character.
' If you look in the Reports section on my web site you will
' find code that uses the ascending and descending char values
' to calculate a more accurate vertical justification.


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
' You have to call the function every time
' during the Report's Detail Format event.
VerticallyCenter Me.ComfortZone
VerticallyCenter Me.CelebrationZone
VerticallyCenter Me.WorryZone
VerticallyCenter Me.DangerZone
End Sub

TIA for any assistance --

Sue Compelling
 

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