Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copied range from excel to word (but not in table-form)
Hello,
I've got a macro which copies a selection to Word. But the problem is that when copying it doesn''t copy the format (including page breaks etc.). Second problem is that it copies it to word in a table. I've got this code: Sub Basis() Dim Wordapp As Object Set Wordapp = CreateObject("Word.Application") Wordapp.Visible = True doc = Wordapp.documents.Add() Sheets("Basis reglement").Visible = True Sheets("Basis reglement").Select Range("D1:D650").Select Selection.Copy Wordapp.Selection.Paste End Sub and I tried stuff like this: WordApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteRTF, Placement:= wdInLine, DisplayAsIcon:=False but it pastes the selection as a figure (and a very small one too).. does anybody have a solution? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copied range from excel to word (but not in table-form)
when you use this:
WordApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteRTF, Placement:= wdInLine, DisplayAsIcon:=False the constant wdPasteRTF and wdInLine both have a value of zero since you are using late binding. Replace those constants with the values Word actually uses for them. WordApp.Selection.PasteSpecial Link:=False, DataType:=1, Placement:= 0, DisplayAsIcon:=False (looks like wdInLine isn't a problem, but wdPasteRTF is) -- Regards, Tom Ogilvy " wrote: Hello, I've got a macro which copies a selection to Word. But the problem is that when copying it doesn''t copy the format (including page breaks etc.). Second problem is that it copies it to word in a table. I've got this code: Sub Basis() Dim Wordapp As Object Set Wordapp = CreateObject("Word.Application") Wordapp.Visible = True doc = Wordapp.documents.Add() Sheets("Basis reglement").Visible = True Sheets("Basis reglement").Select Range("D1:D650").Select Selection.Copy Wordapp.Selection.Paste End Sub and I tried stuff like this: WordApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteRTF, Placement:= wdInLine, DisplayAsIcon:=False but it pastes the selection as a figure (and a very small one too).. does anybody have a solution? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Word O7 looses links with excel 07 when files copied to network fr | Links and Linking in Excel | |||
Excel Financial Statements Copied into Word - No Underlines when p | Charts and Charting in Excel | |||
How do I put my information form Excel into a Word Merge Form? | Excel Discussion (Misc queries) | |||
Excel Object copied to Word not printing in color | Excel Discussion (Misc queries) | |||
need to use vba to refer that if a checkbox is checked.. the contents beside it will be copied to another range - to add to excel form | Excel Programming |