PC Review


Reply
Thread Tools Rate Thread

AddTextBox Position Fix

 
 
MattPil29
Guest
Posts: n/a
 
      19th May 2009
Hi,

I am trying to add a textbox shape to a cell but the zoom level seems to
effect its position. Does anyone know a way of calculating the correct
position regardless of zoom level?

The problem can be seen by running this code:

Sub AddTextBoxesAtDifferentZoomLevels()
Dim rngCell As Range
Dim sngWidthHeight As Single
Dim iZoom As Integer
Dim ioff As Integer
Dim Irow As Integer
'note: row height also affects the layout
sngWidthHeight = 10
For Irow = 1 To 201 Step 50
Set rngCell = Range("A1").Cells(Irow, 1)
ioff = 0
For iZoom = 10 To 200 Step 10
ActiveWindow.Zoom = iZoom
rngCell.Offset(0, ioff) = iZoom
Set shpNew =
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, rngCell.Offset(0,
ioff).Left, rngCell.Top, sngWidthHeight, sngWidthHeight)
ioff = ioff + 1
Next
Next
End Sub


Note each box is supposed to be in a cell on row 0,50,100,150 or 200.

--
Thanks, Matt
 
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
Difference between AddLabel and AddTextbox Edward Microsoft Powerpoint 2 17th Aug 2008 09:31 AM
Need VBA Help with AddTextbox david.f.jenkins@usa.net Microsoft Powerpoint 11 9th Mar 2007 06:32 PM
WinForm UserControl's controls runtime position diff. from design time position Steve Microsoft C# .NET 2 7th Jun 2006 03:52 AM
parameters AddTextbox piet Microsoft Excel Programming 1 11th Sep 2005 02:30 PM
MSOffice component : AddTextBox Merighi Microsoft C# .NET 3 6th Apr 2005 10:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:27 AM.