Prev: undo VBA procedure error when called via change event
Next: ActiveWorkbook.SaveAs Format(Date, "mmddyy") & ".csv"
From: Alan on 20 Sep 2009 20:39 I have a range of cells in an Excel 2003 worksheet that I paste (using VBA) into Word 2003. However, the columns in the resulting table in Word have been stretched out. I tried adjusting the PageWidth in Word, but this does not seem to help. Is there a particular way I can do this to keep the width of the Word table columns the same as the original Excel cells? Thanks in Advance, Alan P.S. Not sure if this belongs in an Excel or Word VBA group.
From: Joel on 21 Sep 2009 00:15 Use PasteSpecial instead of Paste and for workd choose text. Selection.Range.PasteSpecial DataType:=wdPasteText Make sure you are using a word object and not an excel object. "Alan" wrote: > I have a range of cells in an Excel 2003 worksheet that I paste (using > VBA) into Word 2003. However, the columns in the resulting table in > Word have been stretched out. I tried adjusting the PageWidth in > Word, but this does not seem to help. > > Is there a particular way I can do this to keep the width of the Word > table columns the same as the original Excel cells? > > Thanks in Advance, Alan > > P.S. Not sure if this belongs in an Excel or Word VBA group. > > >
From: Alan on 21 Sep 2009 21:41 Joel, Perhaps I was not clear. . . . I am trying to paste Excel cells into Word as a table. Alan
From: Joel on 22 Sep 2009 07:18 Pastespecial can be any of the formats below in word. The RTF and HTML will create tables in word wdPasteBitmap wdPasteDeviceIndependentBitmap wdPasteEnhancedMetafile wdPasteHTML wdPasteHyperlink wdPasteMetafilePicture wdPasteOLEObject wdPasteRTF wdPasteShape wdPasteText I believe the data will not automatically wrap in a table cell in word and will be stretched out. You have to manuall adjust the column widths in the word table after you paste the data into word "OR" create a table first in word with the exact size of the amount of data you are taking from excel with the column width already set to your prefer width. Word when creating a table will keep the size of the table inside the page size. Then select the entire table in word and perform the paste. I usually just adjust the table column in word after I paste the data. It is simple to adjust the columns by selecting in any cell in a column anbd then going to the top of the table and sliding the column width bars. "Alan" wrote: > Joel, > Perhaps I was not clear. . . . I am trying to paste Excel > cells into Word as a table. Alan >
From: Alan on 23 Sep 2009 06:49
The Excel spreadsheet has multiple sections with cells of different width. When I copy these sections individually, everything comes out fine. Alan |