![]() |
copy and paste to doc
guru
After you Paste into Word, you can use APPWD.ActiveDocument.Windows(1).View.TableGridLine s = False to hide the gridlines. -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "guru" wrote in message ... I am using the next code in order to copy a range from a sheet to a word document The problem is that this copy takes the gridlines from the sheet and creates tables in word document . How can i prevent the gridlines not to be paste in the doc.? Sub wordexport() Worksheets("PRAKTIKO_ISOL").Select ''''''CREATE WORD and copy range to it Application.CutCopyMode = xlCut Application.DisplayAlerts = False On Error Resume Next Dim APPWD As Object Dim finalrow As Long 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 Range(Cells(1, 1), Cells(finalrow, 5)).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 ''''' fix document margins With APPWD.ActiveDocument.PageSetup .LineNumbering.Active = False .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 |
All times are GMT +1. The time now is 02:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com