+ Reply to Thread
Results 1 to 2 of 2

Copied range from excel to word (but not in table-form)

  1. #1

    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. #2
    Tom Ogilvy
    Guest

    RE: 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



    "[email protected]" 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1