Results 1 to 11 of 11
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Why Range.Paste failed? (1)

    I tried your macro just now on a long document, and it pasted the text that happened to be on the Clipboard somewhere into the second page of the document.
    Is your document long enough?
    Was there something on the clipboard when you tried with Start:=5000, End:=5000 ?

  2. #2
    Lounger
    Join Date
    Jan 2003
    Location
    Brisbane, Queensland, Australia
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Why Range.Paste failed? (1)

    I wrote a macro for Word 2000:
    //////////////////////
    Sub Macro1()

    ActiveDocument.Range(Start:=5000, End:=5000).Paste

    End Sub
    /////////////////////

    It causes "Run-time error 4198". But if I reduce the number to the range of the 1st page, it works. Why this macro only runs when the spcified range is within the 1st page. <img src=/S/bash.gif border=0 alt=bash width=35 height=39>

  3. #3
    Lounger
    Join Date
    Jan 2003
    Location
    Brisbane, Queensland, Australia
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Why Range.Paste failed? (1)

    Thanx for your reply. I forgot to mention in my post that if you paste text, no error happens. But please try pasting a graphics shape to the 2nd page using this macro, you'll see the error.
    Regards.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Why Range.Paste failed? (1)

    No problem here - see attached screenshot. I'm using Word 2002 SP2 (on Windows XP Home SP1.)
    Attached Images Attached Images
    • File Type: png x.png (9.1 KB, 0 views)

  5. #5
    Lounger
    Join Date
    Jan 2003
    Location
    Brisbane, Queensland, Australia
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Why Range.Paste failed? (1)

    You copied and pasted a bitmap instead of a shape. I tried the bitmap and it also works.
    But please try a rectangle or oval created from the Drawing toolbar and pasted it to the 2nd page.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Why Range.Paste failed? (1)

    OK, sorry, I didn't read your previous reply carefully. I get the error too, trying to paste a shape. No idea why, but I can get around it by moving the selection to the paste location:

    ActiveDocument.Range(Start:=5000, End:=5000).Select
    Selection.Paste

    Normally, I try to avoid moving the selection in a macro, but this may be one of those situations in which it is necessary. I'm curious to see if one of the Word experts will come up with a better solution.

  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Why Range.Paste failed? (1)

    I just tried it with a couple of Autoshapes and it worked fine (Office 2002 SP1 on Windows XP SP1)

    StuartR

  8. #8
    Lounger
    Join Date
    Jan 2003
    Location
    Brisbane, Queensland, Australia
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Why Range.Paste failed? (1)

    Did you paste it to the pages other than the 1st one using the macro?
    In the test I found that if you paste non-inline graphic objects, the error will happen.
    Using selection can avoid the problem but the undesirable thing is that I must move the selection to where I am going to paste.

  9. #9
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Why Range.Paste failed? (1)

    > Did you paste it to the pages other than the 1st one using the macro?
    Yes. I created a few blocks of "The quick brown fox" and a few empty paragraphs to force your Macro to paste in the middle of page 2.
    I drew, cut and pasted a Rectangle from the drawing toolbar and a Block Arrow from Autoshapes.

    StuartR

  10. #10
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Why Range.Paste failed? (1)

    I can't recreate the error either, using a rectangle, and doing a Range.Paste on the second or third page (although the position of the rectangle is pretty unpredictable).

    I'm running Word 2000, patched up to SP2 (Help>About shows 9.0.4402 SR-1). What version are you running?

  11. #11
    Lounger
    Join Date
    Jan 2003
    Location
    Brisbane, Queensland, Australia
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Why Range.Paste failed? (1)

    I am using Word 2000 without SP.
    I'll try patch it first. Maybe it's can be solved by the SP.

Posting Permissions

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