hi try this i would suggest do not merge first two rows in "Feuil"sheet . Increase the row size
Option Explicit Sub Send2Word() Application.ScreenUpdating = False Application.Calculation = xlCalculationManual ' tools ->refrence-> microsoft word Dim wb As Workbook Dim ws As Worksheet Set wb = ThisWorkbook Set ws = wb.Worksheets("Feuil") Dim rng As Range Dim wdApp As New Word.Application Dim wdDoc As Word.Document Dim t As Word.Range Dim myWordFile As String ' make sure u r picking right template ' check the file name of ur template myWordFile = ThisWorkbook.Path & "\Export2Word1.dot" Set rng = ws.Range(ws.Cells(1, 1), ws.Cells(21, 5)) rng.Copy Set wdDoc = wdApp.Documents.Add(myWordFile) Set t = wdDoc.Content t.Paste wdApp.Visible = True wdApp.Activate Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub On Sun, Oct 23, 2011 at 1:09 AM, johny sleeper <josle...@gmail.com> wrote: > Hi, > > I have 1 excel File and 1 word document. I'm using the Microsoft Word > Library reference. > > I would like to send over the data in the excel Sheet named "Feuil" or > Sheet2 (from the vba Project window) to the word document. > > I have written 2 vba codes for this (taken from the web). The 2 codes > creates a new word document. For now, it doesn't matter. Maybe to make > things more simple, I should start from creating a new table and move things > after. > > From the 2 codes, the 1st one works ok ("XL2Wordv1") but the second one > doesn't ("XL2Wordv2"). I have a compile message error : "Can't assign to > read only property". This has to do with the word table object. > > I'll favour the second code one as it seems to me the way to send the data > over without changing the formating of the word table. The word table must > look like the one on the word document. I didn't create it, it's a very > basic table and I just need to fill the data in without making any changes > to the format. > > If you can solve this, I'm already thinking about 1° making a new word > document with a table created from excel vba and inserting it in the > existing word document or 2° working directly on the existing word document > table. > > Please find a word file and an excel file attached > > Thanks if you can help. > > Johann > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- *Regards* * * *Ashish Koul* *http://www.excelvbamacros.com/* P Before printing, think about the environment. -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel
Income Statement 31.05.2011.xlsm
Description: Binary data