View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
GUS GUS is offline
external usenet poster
 
Posts: 45
Default export to word without tables

I am using the following code in order to export part of a sheet to a new
word document and then correct the page margins
The problem is that i want to remove the tables from word especially where
is only text.
The tables are created from worksheet guide lines .


Sub exportword()
Worksheets("PRAKTIKO_ISOL").Select
''''''CREATE WORD PRAKTIKO ISOL

Application.CutCopyMode = xlCut
Application.DisplayAlerts = False
On Error Resume Next


Dim APPWD As Object

Dim i As Integer

Set APPWD = CreateObject("Word.Application")
APPWD.Visible = True



Sheets("PRAKTIKO_ISOL").Select
'Find the last row with data in the database

finalrow = Range("A9999").End(xlUp).Row
''For i = 2 To FinalRow
Sheets("PRAKTIKO_ISOL").Select
Range(Cells(1, 1), Cells(finalrow, 4)).Copy
' Tell Word to create a new document
APPWD.Documents.Add
' Tell Word to paste the contents of the clipboard into the new
document

APPWD.Selection.Paste


Application.CutCopyMode = xlCut

With APPWD.ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
''.TopMargin = CentimetersToPoints(2.54)
''.BottomMargin = CentimetersToPoints(2.54)
''.LeftMargin = CentimetersToPoints(2)
''.RightMargin = CentimetersToPoints(2)
''.Gutter = CentimetersToPoints(0)
''.HeaderDistance = CentimetersToPoints(1.25)
''.FooterDistance = CentimetersToPoints(1.25)
''.PageWidth = Application.InchesToPoints(21)
''.PageHeight = Application.InchesToPoints(29.7)
.LeftMargin = Application.InchesToPoints(1)
.RightMargin = Application.InchesToPoints(1)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(1.25)
.FooterMargin = Application.InchesToPoints(1.25)
End With

Application.DisplayAlerts = True

End Sub