![]() |
|
#1
|
||||
|
||||
![]()
Hi tinfanide,
The following works for me: Code:
Sub TypeTextTypeUnderline() Dim File As String File = "C:\Users\Tin\Desktop\a.docx" Dim oWord As Word.Application Set oWord = New Word.Application Dim oDoc As Word.Document Set oDoc = oWord.Documents.Open(File) oWord.Visible = True Dim tbl As Word.Table Dim Shp As Word.Shape Dim Rng As Word.Range With oDoc Set tbl = .Tables.Add(Range:=.Range, NumRows:=2, NumColumns:=2, _ DefaultTableBehavior:=wdWord8TableBehavior) With tbl .Borders(wdBorderTop).LineStyle = wdLineStyleSingle .Borders(wdBorderRight).LineStyle = wdLineStyleSingle .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle .Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle .Borders(wdBorderVertical).LineStyle = wdLineStyleSingle Set Rng = .Cell(2, 2).Range Rng.Collapse wdCollapseStart End With Set Shp = oDoc.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _ Left:=0, Top:=0, Width:=72, Height:=12, Anchor:=Rng) With Shp .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage .RelativeVerticalPosition = wdRelativeVerticalPositionPage End With End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]() Quote:
Eventually I fixed it in a way that I didn't think was the best solution. What I have expected is still get the textbox positioned relative to the targetted table cell. http://www.youtube.com/watch?v=Hgv-LsQ9tTE&hd=1 |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
tonywatsonmail | Mail Merge | 1 | 01-31-2012 04:37 AM |
![]() |
deltaskye | Word | 5 | 01-27-2012 11:58 AM |
![]() |
robmorleyuk | Word | 1 | 11-01-2011 07:24 AM |
![]() |
pakistanray | Word Tables | 2 | 10-31-2011 08:07 AM |
![]() |
WaltR | Word | 4 | 01-29-2011 11:22 PM |