PC Review


Reply
Thread Tools Rate Thread

Calculating the Screen TwipsPerPixelX and Y

 
 
=?Utf-8?B?Qnl6YW50aW5l?=
Guest
Posts: n/a
 
      25th Jun 2005
Hallo there

I'm trying to determine what my screen TwipsPerPixelX (horixontal) and
TwipsPerPixelY (vertical) are using MS Access 2003 VBA.

I understand that the code in VB is as follows:
Screen.TwipsPerPixelX
Screen.TwipsPerPixelY

Yet if I try to use this code in VBA it doesn't appear to work: I get the
following compile error message:

'Method or data member not found'.

Does anyone know the VBA equivalent?

Any help is greatly appreciated.

 
Reply With Quote
 
 
 
 
Larry Linson
Guest
Posts: n/a
 
      25th Jun 2005
The Screen object in the separate VB product has a TwipsPerPixel property.
Access' Screen object does not. It isn't a "language difference" but a
"product object model difference"

I've been developing in Access since Version 1.0 and have never suffered for
the lack. Perhaps if you'd explain what you are trying to accomplish,
someone could make a worthwhile suggestion.

Larry Linson
Microsoft Access MVP

"Byzantine" <(E-Mail Removed)> wrote in message
news:93228AA6-CFD0-4F65-AF75-(E-Mail Removed)...
> Hallo there
>
> I'm trying to determine what my screen TwipsPerPixelX (horixontal) and
> TwipsPerPixelY (vertical) are using MS Access 2003 VBA.
>
> I understand that the code in VB is as follows:
> Screen.TwipsPerPixelX
> Screen.TwipsPerPixelY
>
> Yet if I try to use this code in VBA it doesn't appear to work: I get the
> following compile error message:
>
> 'Method or data member not found'.
>
> Does anyone know the VBA equivalent?
>
> Any help is greatly appreciated.
>



 
Reply With Quote
 
=?Utf-8?B?Qnl6YW50aW5l?=
Guest
Posts: n/a
 
      25th Jun 2005
Larry, thanks for the quick response.

I'm trying to reset the scale of a map each time its extent changes on my
form, using ESRI's MapObjects2 ActiveX controls (the Map control object and
scalebar object). I'm told by ESRI that the VB code to do this is as follows:

Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As Long)

'Set the ScaleBar's MapExtent
With ScaleBar1.MapExtent
.MinX = Map1.Extent.Left
.MinY = Map1.Extent.Bottom
.MaxX = Map1.Extent.Right
.MaxY = Map1.Extent.Top
End With

'Set the ScaleBar's PageExtent
With ScaleBar1.PageExtent
.MinX = Map1.Left / Screen.TwipsPerPixelX
.MinY = Map1.Top / Screen.TwipsPerPixelY
.MaxX = (Map1.Left + Map1.Width) / Screen.TwipsPerPixelX
.MaxY = (Map1.Top + Map1.Height) / Screen.TwipsPerPixelY
End With

'Refresh the ScaleBar after the Map has changed
ScaleBar1.Refresh
MsgBox "1: " & Format$(ScaleBar1.RFScale, "###,###,###,###,###")
'Label1.Caption="1: " & Format$(ScaleBar1.RFScale,"###,###,###,###,###")

End Sub

The routine falls down at the 'Screen.TwipsPerPixelX' code because of the
product object model difference between VB and VBA.

The ScaleBar1 object is an ESRI MapObjects2.1 scale bar and the Map1 object
is the ESRI MapObjects2 Map control.

ESRI do not appear to have sufficient expertise in MS Access VBA, so I hope
that MS Access experts can help.

Many thanks for continued assistance.


"Larry Linson" wrote:

> The Screen object in the separate VB product has a TwipsPerPixel property.
> Access' Screen object does not. It isn't a "language difference" but a
> "product object model difference"
>
> I've been developing in Access since Version 1.0 and have never suffered for
> the lack. Perhaps if you'd explain what you are trying to accomplish,
> someone could make a worthwhile suggestion.
>
> Larry Linson
> Microsoft Access MVP
>
> "Byzantine" <(E-Mail Removed)> wrote in message
> news:93228AA6-CFD0-4F65-AF75-(E-Mail Removed)...
> > Hallo there
> >
> > I'm trying to determine what my screen TwipsPerPixelX (horixontal) and
> > TwipsPerPixelY (vertical) are using MS Access 2003 VBA.
> >
> > I understand that the code in VB is as follows:
> > Screen.TwipsPerPixelX
> > Screen.TwipsPerPixelY
> >
> > Yet if I try to use this code in VBA it doesn't appear to work: I get the
> > following compile error message:
> >
> > 'Method or data member not found'.
> >
> > Does anyone know the VBA equivalent?
> >
> > Any help is greatly appreciated.
> >

>
>
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      26th Jun 2005
"Byzantine" <(E-Mail Removed)> wrote in message
news:93228AA6-CFD0-4F65-AF75-(E-Mail Removed)
> Hallo there
>
> I'm trying to determine what my screen TwipsPerPixelX (horixontal) and
> TwipsPerPixelY (vertical) are using MS Access 2003 VBA.
>
> I understand that the code in VB is as follows:
> Screen.TwipsPerPixelX
> Screen.TwipsPerPixelY
>
> Yet if I try to use this code in VBA it doesn't appear to work: I get
> the following compile error message:
>
> 'Method or data member not found'.
>
> Does anyone know the VBA equivalent?
>
> Any help is greatly appreciated.


A Google Groups search for "twipsperpixel" in group: *.*access.* turned
this up pretty quickly:

http://support.microsoft.com/default...kb;en-us;94927
ACC: How to Convert Twips to Pixels

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Turn off calculating word count status bottom of screen Night_Queen Microsoft Word Document Management 1 20th Nov 2008 06:35 AM
Calculating recurring date in following month, calculating # days in that period Walterius Microsoft Excel Worksheet Functions 6 4th Jun 2005 11:21 PM
Leftmost part of screen "blued" out when calculating via a macro =?Utf-8?B?bnVya3Vz?= Microsoft Excel Programming 4 17th May 2005 06:36 AM
CALCULATING WORKSHEETS (INCLUDING AGE CALCULATING SHEETS) FOR DOWNLOADING, GREAT FOR PENSIONS/LIFE INSURANCE CALCULATIONS! RICHARD Microsoft Excel Programming 0 15th Mar 2005 01:41 PM
Possible show other screen for "Installing your personal data" screen after the wellcome screen & before logon screen ? Pivert Windows XP Customization 2 18th Apr 2004 05:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:54 AM.