can't undo when Sub EditPaste is overriden?

S

saint

hi, i was overriding EditPaste, then after some manipulation call
Selection.Paste and pasting works fine.

However I noticed that in doing so, Undo feature is not available (grayed
out) and says "Can't Undo" instead of the usual "Undo Paste".

Should there be any code needed on the override to make this work?
 
J

Jean-Guy Marcil

saint was telling us:
saint nous racontait que :
hi, i was overriding EditPaste, then after some manipulation call
Selection.Paste and pasting works fine.

However I noticed that in doing so, Undo feature is not available
(grayed out) and says "Can't Undo" instead of the usual "Undo Paste".

Should there be any code needed on the override to make this work?

I tested your situation with:

Sub EditPaste()

ActiveDocument.Paragraphs(1).Range.Copy
Selection.Paste

End Sub

After I hit CTRL-V to paste, my undo list allowed me to undo the paste
action. In fact, the first item in the undo list was:
VBA-Selection.Paste

So, there is something else going on. You wrote
" hi, i was overriding EditPaste, then after some manipulation call"
I would bet that the answer lies in the "some manipulation" part. We would
need to see that code (I assume you mean that those manipulations are done
through VBA).

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
S

saint

Unfortunately, the manipulation is actually done using C# (vsto). Involves a
managed object. It is in the C# that I call Selection.Paste

I tested Selection.Paste in VBA and works fine indeed, I removed any
manipulation in the c# method called and just included Selection.Paste but
still no luck.
 
S

saint

You're right. I think I was doing something wrong when I tested
Selection.Paste in C#. Now it displays Undo VBA-Selection.Paste if that's the
only code in the method called. So it must be in the "manipulation" section.

I'll guess I now have to figure out what is really causing it.

Thanks a lot.
 
J

Jean-Guy Marcil

saint was telling us:
saint nous racontait que :
You're right. I think I was doing something wrong when I tested
Selection.Paste in C#. Now it displays Undo VBA-Selection.Paste if
that's the only code in the method called. So it must be in the
"manipulation" section.

I'll guess I now have to figure out what is really causing it.

Good luck.

Since you are using C#, you may want to post in the office.developer group.


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top