Using metric measurements in VBA

  • Thread starter Thread starter Kelvin Middleton
  • Start date Start date
K

Kelvin Middleton

Hi, thanks for all the help so far. New problem here, I understand that
Access uses 'twips' as a size measurement in vba. I'm wanting to specify a
width measure on a control in centimeters, I've consulted the help file
which says to simply add 'cm' at the end of my entry, however it doesn't
work.

What am I doing wrong?

Using Access 2003 but the DB is in 2000 format.

TIA

Kelv

P.S. Dirk thanks for the advice on my email.
 
You should be able to enter 'cm' when specifying a size via the UI, but in
code you always have to use twips. There are approximately 567 twips in a
centimetre, so you could specify a size of 3cm as 1701, or as 567 * 3, or -
and this will make for the most readable code ...

Public Const glngcTwipsPerCentimeter As Long = 567
....
Something.Width = 3 * glngcTwipsPerCentimeter

There is some slight rounding that goes on in the conversion process, so
you'll likely end up with a control that is 2.98cm rather than exactly 3cm,
but there is, as far as I know, no way to avoid that.
 

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

Back
Top