LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Control WORD from VBA EXCEL. ¿How can I erase data?

Sorry I couldn't get back to you sooner. I'm glad you found a solution.
What I use is a Word macro that takes data copied from Excel and creates a
Word table with the same basic formatting (as opposed to pasting the Excel
data into an empty table that it won't fit into.) To use, filter your
range in Excel and copy, then open Word and run this.

Cheers!
Ed

Sub PasteTable()
'
Dim MyTable As Table
Dim strStyle As String, szFont As Long
strStyle = Selection.Style
szFont = Selection.Font.Size

Selection.PasteSpecial Link:=False, DataType:=wdPasteRTF, Placement:= _
wdInLine, DisplayAsIcon:=False

Set MyTable = Selection.Tables(1)
With MyTable
.Shading.Texture = wdTextureNone
.Shading.ForegroundPatternColor = wdColorAutomatic
.Shading.BackgroundPatternColor = wdColorAutomatic
.Range.Font.Color = wdColorBlack
.Range.Style = strStyle
.Range.Font.Size = szFont
With .Borders
.InsideLineStyle = wdLineStyleSingle
.InsideLineWidth = wdLineWidth050pt
.OutsideLineStyle = wdLineStyleSingle
.OutsideLineWidth = wdLineWidth050pt
End With
End With

MyTable.Select
WordBasic.TableRowHeight RulerStyle:=0, LeftIndent:="0", Alignment:=0, _
AllowRowSplit:=1, TableDir:=0
Selection.Cells.AutoFit
WordBasic.TableRowHeight RulerStyle:=0, LeftIndent:="0", Alignment:=1, _
AllowRowSplit:=1, TableDir:=0
WordBasic.TableRowHeight RulerStyle:=0, LineSpacingRule:=0, LeftIndent:=
_
"0", Alignment:=1, AllowRowSplit:=1, TableDir:=0

End Sub
"internacio" wrote
in message ...

Finally it works!!

With the table in word i execute this sentece as many times as rows I
dont need. (i is the first row I has not changed)

ActiveDocument.Tables(1).Rows(i).Delete


Thanks a lot for all the help given, I really apreciate it.


--
internacio
------------------------------------------------------------------------
internacio's Profile:

http://www.excelforum.com/member.php...o&userid=30960
View this thread: http://www.excelforum.com/showthread...hreadid=519727





 
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
why do print range erase in Excel when import data from access MaryD Excel Worksheet Functions 1 February 17th 10 08:23 PM
"how to erase data save on excel Mario New Users to Excel 1 September 15th 07 05:02 AM
Control Word through Excel Jocke Excel Programming 1 June 24th 05 03:38 PM
Word Control in Excel Stuart[_5_] Excel Programming 10 July 11th 04 08:47 PM
how to control word from excel Torstein S. Johnsen[_2_] Excel Programming 1 February 10th 04 02:10 PM


All times are GMT +1. The time now is 01:57 AM.

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

About Us

"It's about Microsoft Excel"