Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Screen updating

I have a similar problem to Dennis. I am trying to get VB to set a scal for
cells & shapes to suit the current users screen size. I run VB code to change
the sizing of the shapes for the size shed the customer wants. I'm not sure
of the code I need to do this.

Please help
--
SS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Screen updating

Shapes have a Height and Width property.

for each shp in ActiceSheet.Shapes
with shp
.Height = 1.25 * .Height
.Width = 1.37 * .Width
End With
Next

these are also scalewidth and scaleheight properties

Also look at the LockAspectRatio property.

See help for details.

--
Regards,
Tom Ogilvy


"StevenS" wrote in message
...
I have a similar problem to Dennis. I am trying to get VB to set a scal

for
cells & shapes to suit the current users screen size. I run VB code to

change
the sizing of the shapes for the size shed the customer wants. I'm not

sure
of the code I need to do this.

Please help
--
SS



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Screen updating

Hi Tom. I have hard coded the top properties for my shapes, this is the
problem. I have to get my programme to determine the new users monitor size
and set new top properties for my shapes. I am not sure on how to get the new
users monitor size and how to give new top values to the shapes.
--
SS


"Tom Ogilvy" wrote:

Shapes have a Height and Width property.

for each shp in ActiceSheet.Shapes
with shp
.Height = 1.25 * .Height
.Width = 1.37 * .Width
End With
Next

these are also scalewidth and scaleheight properties

Also look at the LockAspectRatio property.

See help for details.

--
Regards,
Tom Ogilvy


"StevenS" wrote in message
...
I have a similar problem to Dennis. I am trying to get VB to set a scal

for
cells & shapes to suit the current users screen size. I run VB code to

change
the sizing of the shapes for the size shed the customer wants. I'm not

sure
of the code I need to do this.

Please help
--
SS




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Screen updating

Everything you wanted to know about monitors but were affraid to ask...

Declare Function GetDeviceCaps Lib "Gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Declare Function GetDC Lib "User32" _
(ByVal hWnd As Long) As Long
Declare Function ReleaseDC Lib "User32" _
(ByVal hWnd As Long, ByVal hdc As Long) As Long

Public Function HRes() As Integer
'Returns the horizontal resolution in pixels
Dim lDC As Long
lDC = GetDC(0)
HRes = GetDeviceCaps(lDC, 8)
ReleaseDC 0, lDC
End Function

Public Function VRes() As Integer
'Returns the vertical resolution in pixels
Dim lDC As Long
lDC = GetDC(0)
VRes = GetDeviceCaps(lDC, 10)
ReleaseDC 0, lDC
End Function

Public Function ColorDepth() As Integer
'Returns the color depth in bits per pixel
Dim lDC As Long
lDC = GetDC(0)
ColorDepth = GetDeviceCaps(lDC, 12) _
* GetDeviceCaps(lDC, 14)
ReleaseDC 0, lDC
End Function

Public Function Colors() As Single
'Returns the number of available colors
Dim lDC As Long
lDC = GetDC(0)
Colors = 2 ^ (GetDeviceCaps(lDC, 12) _
* GetDeviceCaps(lDC, 14))
ReleaseDC 0, lDC
End Function

Public Function VRefresh() As Integer
'Returns the vertical refresh rate in Hz
Dim lDC As Long
lDC = GetDC(0)
VRefresh = GetDeviceCaps(lDC, 116)
ReleaseDC 0, lDC
End Function

--
HTH...

Jim Thomlinson


"StevenS" wrote:

Hi Tom. I have hard coded the top properties for my shapes, this is the
problem. I have to get my programme to determine the new users monitor size
and set new top properties for my shapes. I am not sure on how to get the new
users monitor size and how to give new top values to the shapes.
--
SS


"Tom Ogilvy" wrote:

Shapes have a Height and Width property.

for each shp in ActiceSheet.Shapes
with shp
.Height = 1.25 * .Height
.Width = 1.37 * .Width
End With
Next

these are also scalewidth and scaleheight properties

Also look at the LockAspectRatio property.

See help for details.

--
Regards,
Tom Ogilvy


"StevenS" wrote in message
...
I have a similar problem to Dennis. I am trying to get VB to set a scal

for
cells & shapes to suit the current users screen size. I run VB code to

change
the sizing of the shapes for the size shed the customer wants. I'm not

sure
of the code I need to do this.

Please help
--
SS




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Screen updating

Excellent. Excuse my ignorace. Where should this information be placed. When
my user opens the programme I want it to fit everything to the screen.
--
SS


"Jim Thomlinson" wrote:

Everything you wanted to know about monitors but were affraid to ask...

Declare Function GetDeviceCaps Lib "Gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Declare Function GetDC Lib "User32" _
(ByVal hWnd As Long) As Long
Declare Function ReleaseDC Lib "User32" _
(ByVal hWnd As Long, ByVal hdc As Long) As Long

Public Function HRes() As Integer
'Returns the horizontal resolution in pixels
Dim lDC As Long
lDC = GetDC(0)
HRes = GetDeviceCaps(lDC, 8)
ReleaseDC 0, lDC
End Function

Public Function VRes() As Integer
'Returns the vertical resolution in pixels
Dim lDC As Long
lDC = GetDC(0)
VRes = GetDeviceCaps(lDC, 10)
ReleaseDC 0, lDC
End Function

Public Function ColorDepth() As Integer
'Returns the color depth in bits per pixel
Dim lDC As Long
lDC = GetDC(0)
ColorDepth = GetDeviceCaps(lDC, 12) _
* GetDeviceCaps(lDC, 14)
ReleaseDC 0, lDC
End Function

Public Function Colors() As Single
'Returns the number of available colors
Dim lDC As Long
lDC = GetDC(0)
Colors = 2 ^ (GetDeviceCaps(lDC, 12) _
* GetDeviceCaps(lDC, 14))
ReleaseDC 0, lDC
End Function

Public Function VRefresh() As Integer
'Returns the vertical refresh rate in Hz
Dim lDC As Long
lDC = GetDC(0)
VRefresh = GetDeviceCaps(lDC, 116)
ReleaseDC 0, lDC
End Function

--
HTH...

Jim Thomlinson


"StevenS" wrote:

Hi Tom. I have hard coded the top properties for my shapes, this is the
problem. I have to get my programme to determine the new users monitor size
and set new top properties for my shapes. I am not sure on how to get the new
users monitor size and how to give new top values to the shapes.
--
SS


"Tom Ogilvy" wrote:

Shapes have a Height and Width property.

for each shp in ActiceSheet.Shapes
with shp
.Height = 1.25 * .Height
.Width = 1.37 * .Width
End With
Next

these are also scalewidth and scaleheight properties

Also look at the LockAspectRatio property.

See help for details.

--
Regards,
Tom Ogilvy


"StevenS" wrote in message
...
I have a similar problem to Dennis. I am trying to get VB to set a scal
for
cells & shapes to suit the current users screen size. I run VB code to
change
the sizing of the shapes for the size shed the customer wants. I'm not
sure
of the code I need to do this.

Please help
--
SS





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Screen updating

This code can just be placed into a regular code module. You can get the
screen resolution by adding the function VRes and HRes.
--
HTH...

Jim Thomlinson


"StevenS" wrote:

Excellent. Excuse my ignorace. Where should this information be placed. When
my user opens the programme I want it to fit everything to the screen.
--
SS


"Jim Thomlinson" wrote:

Everything you wanted to know about monitors but were affraid to ask...

Declare Function GetDeviceCaps Lib "Gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Declare Function GetDC Lib "User32" _
(ByVal hWnd As Long) As Long
Declare Function ReleaseDC Lib "User32" _
(ByVal hWnd As Long, ByVal hdc As Long) As Long

Public Function HRes() As Integer
'Returns the horizontal resolution in pixels
Dim lDC As Long
lDC = GetDC(0)
HRes = GetDeviceCaps(lDC, 8)
ReleaseDC 0, lDC
End Function

Public Function VRes() As Integer
'Returns the vertical resolution in pixels
Dim lDC As Long
lDC = GetDC(0)
VRes = GetDeviceCaps(lDC, 10)
ReleaseDC 0, lDC
End Function

Public Function ColorDepth() As Integer
'Returns the color depth in bits per pixel
Dim lDC As Long
lDC = GetDC(0)
ColorDepth = GetDeviceCaps(lDC, 12) _
* GetDeviceCaps(lDC, 14)
ReleaseDC 0, lDC
End Function

Public Function Colors() As Single
'Returns the number of available colors
Dim lDC As Long
lDC = GetDC(0)
Colors = 2 ^ (GetDeviceCaps(lDC, 12) _
* GetDeviceCaps(lDC, 14))
ReleaseDC 0, lDC
End Function

Public Function VRefresh() As Integer
'Returns the vertical refresh rate in Hz
Dim lDC As Long
lDC = GetDC(0)
VRefresh = GetDeviceCaps(lDC, 116)
ReleaseDC 0, lDC
End Function

--
HTH...

Jim Thomlinson


"StevenS" wrote:

Hi Tom. I have hard coded the top properties for my shapes, this is the
problem. I have to get my programme to determine the new users monitor size
and set new top properties for my shapes. I am not sure on how to get the new
users monitor size and how to give new top values to the shapes.
--
SS


"Tom Ogilvy" wrote:

Shapes have a Height and Width property.

for each shp in ActiceSheet.Shapes
with shp
.Height = 1.25 * .Height
.Width = 1.37 * .Width
End With
Next

these are also scalewidth and scaleheight properties

Also look at the LockAspectRatio property.

See help for details.

--
Regards,
Tom Ogilvy


"StevenS" wrote in message
...
I have a similar problem to Dennis. I am trying to get VB to set a scal
for
cells & shapes to suit the current users screen size. I run VB code to
change
the sizing of the shapes for the size shed the customer wants. I'm not
sure
of the code I need to do this.

Please help
--
SS



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Screen updating

Unless you are going to predetermine the locations of your shapes for each
resolution setting, I think you can skip all the API stuff and just work
with

set rng = ActiveWindow.VisibleRange

If Excel is not full screen, then knowing the resolution doesn't buy you
much.

Assume you want one shape to start at the top if the visible range and
centered horizontally

Sub EFG()
Set shp = ActiveSheet.Shapes(1)
With shp
.Top = ActiveWindow.VisibleRange.Top
.Left = ActiveWindow.VisibleRange.Width / 2 - .Width / 2
End With

End Sub

This is just an example - you would have to adapt it to accomplish what you
want to do.

--
Regards,



"StevenS" wrote in message
...
Excellent. Excuse my ignorace. Where should this information be placed.

When
my user opens the programme I want it to fit everything to the screen.
--
SS


"Jim Thomlinson" wrote:

Everything you wanted to know about monitors but were affraid to ask...

Declare Function GetDeviceCaps Lib "Gdi32" _
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Declare Function GetDC Lib "User32" _
(ByVal hWnd As Long) As Long
Declare Function ReleaseDC Lib "User32" _
(ByVal hWnd As Long, ByVal hdc As Long) As Long

Public Function HRes() As Integer
'Returns the horizontal resolution in pixels
Dim lDC As Long
lDC = GetDC(0)
HRes = GetDeviceCaps(lDC, 8)
ReleaseDC 0, lDC
End Function

Public Function VRes() As Integer
'Returns the vertical resolution in pixels
Dim lDC As Long
lDC = GetDC(0)
VRes = GetDeviceCaps(lDC, 10)
ReleaseDC 0, lDC
End Function

Public Function ColorDepth() As Integer
'Returns the color depth in bits per pixel
Dim lDC As Long
lDC = GetDC(0)
ColorDepth = GetDeviceCaps(lDC, 12) _
* GetDeviceCaps(lDC, 14)
ReleaseDC 0, lDC
End Function

Public Function Colors() As Single
'Returns the number of available colors
Dim lDC As Long
lDC = GetDC(0)
Colors = 2 ^ (GetDeviceCaps(lDC, 12) _
* GetDeviceCaps(lDC, 14))
ReleaseDC 0, lDC
End Function

Public Function VRefresh() As Integer
'Returns the vertical refresh rate in Hz
Dim lDC As Long
lDC = GetDC(0)
VRefresh = GetDeviceCaps(lDC, 116)
ReleaseDC 0, lDC
End Function

--
HTH...

Jim Thomlinson


"StevenS" wrote:

Hi Tom. I have hard coded the top properties for my shapes, this is

the
problem. I have to get my programme to determine the new users monitor

size
and set new top properties for my shapes. I am not sure on how to get

the new
users monitor size and how to give new top values to the shapes.
--
SS


"Tom Ogilvy" wrote:

Shapes have a Height and Width property.

for each shp in ActiceSheet.Shapes
with shp
.Height = 1.25 * .Height
.Width = 1.37 * .Width
End With
Next

these are also scalewidth and scaleheight properties

Also look at the LockAspectRatio property.

See help for details.

--
Regards,
Tom Ogilvy


"StevenS" wrote in message
...
I have a similar problem to Dennis. I am trying to get VB to set a

scal
for
cells & shapes to suit the current users screen size. I run VB

code to
change
the sizing of the shapes for the size shed the customer wants. I'm

not
sure
of the code I need to do this.

Please help
--
SS





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
SCREEN NOT UPDATING ub Excel Worksheet Functions 2 March 18th 09 11:52 AM
Screen Updating KG[_4_] Excel Programming 0 January 16th 05 05:09 PM
Screen updating Keith[_11_] Excel Programming 2 June 2nd 04 01:10 PM
Screen updating Stratuser Excel Programming 0 April 16th 04 05:20 PM
Screen updating Stratuser Excel Programming 0 April 16th 04 05:20 PM


All times are GMT +1. The time now is 11:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"