Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Mon, 6 Oct 2008 11:06:05 -0700,    group: microsoft.public.word.vba.general        back       


Select textbox from inside   
Hi all

My macro starts when the user has selected something inside a textbox.
How can I find out the height of the textbox I'm currently inside?

Thanks for your help

Dan
date: Mon, 6 Oct 2008 11:06:05 -0700   author:   dange

RE: Select textbox from inside   
You can get that information from the shape as a shape range object:

Sub TheShape()

    Dim doc As Document
    Dim dblHeight As Double
    Dim dblWidth As Double
    Dim strName As String
    Dim strHeight As String
    Dim strWidth As String
    Set doc = ThisDocument
    
    strName = Selection.ShapeRange.Name
    strHeight = Selection.ShapeRange.Height
    strWidth = Selection.ShapeRange.Width
    
     MsgBox "The text box is " & strHeight & _
        " points tall and " & strWidth & _
        " points wide and is named " & strName
        
    

End Sub
-- 
Kevin Backmann


"dange" wrote:

> Hi all
> 
> My macro starts when the user has selected something inside a textbox.
> How can I find out the height of the textbox I'm currently inside?
> 
> Thanks for your help
> 
> Dan
date: Mon, 6 Oct 2008 12:09:19 -0700   author:   Kevin B Bgone

RE: Select textbox from inside   
Ignore the variable declartions for dblHeight and dblWidth as they're not 
used in the macro.  
-- 
Kevin Backmann


"Kevin B" wrote:

> You can get that information from the shape as a shape range object:
> 
> Sub TheShape()
> 
>     Dim doc As Document
>     Dim dblHeight As Double
>     Dim dblWidth As Double
>     Dim strName As String
>     Dim strHeight As String
>     Dim strWidth As String
>     Set doc = ThisDocument
>     
>     strName = Selection.ShapeRange.Name
>     strHeight = Selection.ShapeRange.Height
>     strWidth = Selection.ShapeRange.Width
>     
>      MsgBox "The text box is " & strHeight & _
>         " points tall and " & strWidth & _
>         " points wide and is named " & strName
>         
>     
> 
> End Sub
> -- 
> Kevin Backmann
> 
> 
> "dange" wrote:
> 
> > Hi all
> > 
> > My macro starts when the user has selected something inside a textbox.
> > How can I find out the height of the textbox I'm currently inside?
> > 
> > Thanks for your help
> > 
> > Dan
date: Mon, 6 Oct 2008 12:15:01 -0700   author:   Kevin B Bgone

RE: Select textbox from inside   
Thanks for your quick answer.
This works fine if the selection is a text.
But when another shape is inside the textbox and the shape is selected, I 
get of corse the size of the selected shape.
How to get the height of the textbox in this case?

Thanks again
Dan

"Kevin B" wrote:

> You can get that information from the shape as a shape range object:
> 
> Sub TheShape()
> 
>     Dim doc As Document
>     Dim dblHeight As Double
>     Dim dblWidth As Double
>     Dim strName As String
>     Dim strHeight As String
>     Dim strWidth As String
>     Set doc = ThisDocument
>     
>     strName = Selection.ShapeRange.Name
>     strHeight = Selection.ShapeRange.Height
>     strWidth = Selection.ShapeRange.Width
>     
>      MsgBox "The text box is " & strHeight & _
>         " points tall and " & strWidth & _
>         " points wide and is named " & strName
>         
>     
> 
> End Sub
> -- 
> Kevin Backmann
> 
> 
> "dange" wrote:
> 
> > Hi all
> > 
> > My macro starts when the user has selected something inside a textbox.
> > How can I find out the height of the textbox I'm currently inside?
> > 
> > Thanks for your help
> > 
> > Dan
date: Mon, 6 Oct 2008 12:30:37 -0700   author:   dange

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us