Copy paste issue. [Excel to word]
Hey guys.
I've made a script where you can load/import an excel file and paste this in word.
Here is the code:
Code:
Private Sub CommandButton2_Click()
Dim lngCount As Long
i = 1
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
.Show
For lngCount = 1 To .SelectedItems.Count
OpenExcelWorkbook .SelectedItems.Item(lngCount)
Next lngCount
End With
End Sub
Public Sub OpenExcelWorkbook(file As String)
Dim app As Object
Dim workbook As Object
Set app = CreateObject("Excel.Application")
Set workbook = app.Workbooks.Open(file)
app.Sheets("Blad1").Range("A:J").Copy
End Sub
Private Sub plakexcel()
Selection.GoTo What:=wdGoToPage, Count:=8
Selection.MoveDown Unit:=wdLine, Count:=10
Selection.PasteAndFormat (wdPasteDefault)
Selection.MoveUp Unit:=wdLine, Count:=1
sluiten
End Sub
Now here comes my issue. Once I copy+paste rows A to J, all works well. But once field row A overlaps row B because of the width of the text, it puts it on the next line.
Or when row A to J are filled with text it pushes it off to the edge of the document.
Do you guys have any better methods to 'import' excel rows A to J in word?
Thanks in advance.
Re: Copy paste issue. [Excel to word]
as alternates
you can insert a workbook object into your document
or you can insert the data into a table
Re: Copy paste issue. [Excel to word]
Any example on how to do this?
The issue is it will paste everything, so when row J is out of range of the A4 sheet its not visible or puts it on the next row ;(
I'll figure that out, but how do i insert it into a table or workbook object?
The workbook object won't auto resize to the desired length... Will it?
Re: Copy paste issue. [Excel to word]
Quote:
The workbook object won't auto resize to the desired length... Will it?
no idea
i would look at your problem except that i can not open later version off files in office 2000
Re: Copy paste issue. [Excel to word]
I think the workbook part is a no-go. When I insert a workbook it gets very small and I could resize it but I can't get it to auto-resize I think.
P.S. Want me to PM you Office 2010? Can be installed next to 2000. (you can keep both versions)
Re: Copy paste issue. [Excel to word]
Quote:
P.S. Want me to PM you Office 2010? Can be installed next to 2000. (you can keep both versions)
thanks, but no, with the speed of the internet here it would take a week
you can try saveas the files as earlier version