Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

resize table with macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ivano - 11 Apr 2006 23:17 GMT
Hi,
I have a Word document and have many many pasted objects.  I selected an
Excel range then went back into Word and Paste special >link>Excel Worksheet
object.  
I have recorded a macro that basically centers it, and sets the absolute
position.  Howver, when I change the height and width of the Excel object the
macro doesn't record what I picked for values.  It has a bunch of other
settings but on the one that will resize the table to 6" by 7".  How do I
insert whatever into the macro so it will resize it???
This is the macro:

Sub Align_Center()
'
   Selection.ShapeRange.Fill.Visible = msoFalse
   Selection.ShapeRange.Fill.Solid
   Selection.ShapeRange.Fill.Transparency = 0#
   Selection.ShapeRange.Line.Weight = 0.75
   Selection.ShapeRange.Line.DashStyle = msoLineSolid
   Selection.ShapeRange.Line.Style = msoLineSingle
   Selection.ShapeRange.Line.Transparency = 0#
   Selection.ShapeRange.Line.Visible = msoTrue
   Selection.ShapeRange.Line.ForeColor.RGB = RGB(0, 0, 0)
   Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
   Selection.ShapeRange.LockAspectRatio = msoFalse
   Selection.ShapeRange.Left = 54#
   Selection.ShapeRange.Top = 187.2
   Selection.ShapeRange.RelativeHorizontalPosition = _
       wdRelativeHorizontalPositionColumn
   Selection.ShapeRange.RelativeVerticalPosition = _
       wdRelativeVerticalPositionPage
   Selection.ShapeRange.Left = wdShapeCenter
   Selection.ShapeRange.Top = InchesToPoints(2.6)
   Selection.ShapeRange.LockAnchor = False
   Selection.ShapeRange.WrapFormat.AllowOverlap = True
   Selection.ShapeRange.WrapFormat.Side = wdWrapBoth
   Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
   Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.DistanceRight = InchesToPoints(0.13)
   Selection.ShapeRange.WrapFormat.Type = wdWrapTopBottom
       
End Sub

Many thanks,
Cindy M  -WordMVP- - 12 Apr 2006 14:56 GMT
Hi =?Utf-8?B?SXZhbm8=?=,

> I have a Word document and have many many pasted objects.  I selected an
> Excel range then went back into Word and Paste special >link>Excel Worksheet
[quoted text clipped - 4 lines]
> settings but on the one that will resize the table to 6" by 7".  How do I
> insert whatever into the macro so it will resize it???

See if these lines are what you're looking for

   Selection.ShapeRange.Height = InchesToPoints(7)
   Selection.ShapeRange.Width = InchesToPoints(6)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :-)

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.