Consulting

Results 1 to 4 of 4

Thread: Paste range as image in merge

  1. #1

    Question Paste range as image in merge

    Hi everyone,

    I'm trying to replace some text in a Word-file with a copy of a range from Excel. I want to paste the range as an image. At this point, it does paste the range as an image, but I can't seem to fix it so it would replace the specific text. My code is as following:
            With msWord.Content.Find
                   Sheets("Offerte").Range("I13:M160").Select
                    Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
                    .Text = ("<<TABEL>>")
                    .Replacement.Text = msWord.Selection.Paste
                    msWord.Selection.TypeParagraph
               End With
    So to elaborate: the Range I13:M160 of the Sheet "Offerte" has to replace the text "<<Tabel>>" in the Word-document. Everything works, except for the replacement of the text.

    Any ideas? Many thanks in advance!

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    You can't do it that way - you can only use valid Find/Replace expressions, which .Replacement.Text = msWord.Selection.Paste is not. Copy the Excel range, then use:
    .Replacement.Text = "^c"
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Thank you for your answer, but unfortunately this doesn't work either. With ^c or ^v nothing happens. Even when I put in a timer (Sleep). When a try to send a ^v in a seperated line only the 'v' appears in the document. And it will just appear at the top of the document.

    Any ideas?

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Perhaps you need to study a bit more on: a) what valid Find and Replace expressions can be (There was a reason I said to use ^c and I very much doubt you really want to use ^v); and b) what you actually need to add to your code to make a Find/Replace execute...
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Tags for this Thread

Posting Permissions

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