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

This seemed to work pretty well for me:

Option Explicit
Sub testme()

Dim myShape As Shape
Dim HalfHeight As Double
Dim HalfWidth As Double
Dim myShapeHeight As Double
Dim myShapeWidth As Double

myShapeHeight = 72
myShapeWidth = 72

With ActiveWindow.VisibleRange
HalfHeight = (.Height / 2) - (myShapeHeight / 2) + .Top
HalfWidth = (.Width / 2) - (myShapeWidth / 2) + .Left
End With

With ActiveSheet
Set myShape = .Shapes.AddShape(Type:=msoShapeSmileyFace, _
Top:=HalfHeight, Left:=HalfWidth, _
Width:=myShapeWidth, Height:=myShapeHeight)
myShape.Name = "shp" & Format(Now, "yyyymmdd_hhmmss")
End With

End Sub



Ronbo wrote:

I am trying to create a routine that will put an autoshape in the middle of
the screen/window without using an absolute address. It seems simple but I
am not finding anything on it. What I have is;

ActiveSheet.Shapes.AddShape(msoShapeSmileyFace, 756.75, 423.75, 72#, 72#). _
Select

What I need is to change the absolute address of 756.75, 423.75 to something
like ActiveWindow. Select
Top.250
Left.250
ActiveSheet.Shapes.AddShape(msoShapeSmileyFace, 72#, 72#)

As always any help is appreciated.


--

Dave Peterson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Screen Position

Dave:

It's always great to see the response from a question, coming from one of
the qurus. Your programming was PERFECT!

Thanks a lot for taking the time and sharing your expertise to provide the
code.
It is truly appreciated.

"Dave Peterson" wrote:

This seemed to work pretty well for me:

Option Explicit
Sub testme()

Dim myShape As Shape
Dim HalfHeight As Double
Dim HalfWidth As Double
Dim myShapeHeight As Double
Dim myShapeWidth As Double

myShapeHeight = 72
myShapeWidth = 72

With ActiveWindow.VisibleRange
HalfHeight = (.Height / 2) - (myShapeHeight / 2) + .Top
HalfWidth = (.Width / 2) - (myShapeWidth / 2) + .Left
End With

With ActiveSheet
Set myShape = .Shapes.AddShape(Type:=msoShapeSmileyFace, _
Top:=HalfHeight, Left:=HalfWidth, _
Width:=myShapeWidth, Height:=myShapeHeight)
myShape.Name = "shp" & Format(Now, "yyyymmdd_hhmmss")
End With

End Sub



Ronbo wrote:

I am trying to create a routine that will put an autoshape in the middle of
the screen/window without using an absolute address. It seems simple but I
am not finding anything on it. What I have is;

ActiveSheet.Shapes.AddShape(msoShapeSmileyFace, 756.75, 423.75, 72#, 72#). _
Select

What I need is to change the absolute address of 756.75, 423.75 to something
like ActiveWindow. Select
Top.250
Left.250
ActiveSheet.Shapes.AddShape(msoShapeSmileyFace, 72#, 72#)

As always any help is appreciated.


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Screen Position

Glad it worked the way you wanted.

Ronbo wrote:

Dave:

It's always great to see the response from a question, coming from one of
the qurus. Your programming was PERFECT!

Thanks a lot for taking the time and sharing your expertise to provide the
code.
It is truly appreciated.

"Dave Peterson" wrote:

This seemed to work pretty well for me:

Option Explicit
Sub testme()

Dim myShape As Shape
Dim HalfHeight As Double
Dim HalfWidth As Double
Dim myShapeHeight As Double
Dim myShapeWidth As Double

myShapeHeight = 72
myShapeWidth = 72

With ActiveWindow.VisibleRange
HalfHeight = (.Height / 2) - (myShapeHeight / 2) + .Top
HalfWidth = (.Width / 2) - (myShapeWidth / 2) + .Left
End With

With ActiveSheet
Set myShape = .Shapes.AddShape(Type:=msoShapeSmileyFace, _
Top:=HalfHeight, Left:=HalfWidth, _
Width:=myShapeWidth, Height:=myShapeHeight)
myShape.Name = "shp" & Format(Now, "yyyymmdd_hhmmss")
End With

End Sub



Ronbo wrote:

I am trying to create a routine that will put an autoshape in the middle of
the screen/window without using an absolute address. It seems simple but I
am not finding anything on it. What I have is;

ActiveSheet.Shapes.AddShape(msoShapeSmileyFace, 756.75, 423.75, 72#, 72#). _
Select

What I need is to change the absolute address of 756.75, 423.75 to something
like ActiveWindow. Select
Top.250
Left.250
ActiveSheet.Shapes.AddShape(msoShapeSmileyFace, 72#, 72#)

As always any help is appreciated.


--

Dave Peterson


--

Dave Peterson
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
Can I fix the position of an object on the screen? Bob Arnett Excel Discussion (Misc queries) 0 October 27th 09 05:46 PM
screen position indication? nastech Excel Discussion (Misc queries) 1 August 17th 06 07:55 PM
Position of CellCursor on Screen (absolute position) [email protected] Excel Programming 1 November 23rd 05 02:23 AM
MsgBox Screen Position James Montgomery Excel Programming 2 November 15th 04 10:50 PM
InputBox Screen Position James Montgomery Excel Programming 4 November 10th 04 02:25 PM


All times are GMT +1. The time now is 09:21 PM.

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

About Us

"It's about Microsoft Excel"