Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word O7 looses links with excel 07 when files copied to network fr Brian Links and Linking in Excel 1 November 28th 08 11:15 AM
Excel Financial Statements Copied into Word - No Underlines when p MAB Charts and Charting in Excel 3 December 18th 07 07:46 PM
How do I put my information form Excel into a Word Merge Form? Jackie Excel Discussion (Misc queries) 2 March 16th 06 08:16 PM
Excel Object copied to Word not printing in color dmotika Excel Discussion (Misc queries) 0 May 26th 05 04:40 PM
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 Cheryl[_2_] Excel Programming 0 May 21st 04 08:50 PM


All times are GMT +1. The time now is 08:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"