Is Copy/Paste with VBA "Safe"?

R

Robin Tucker

Is copy/paste using VBA safe with respect to other applications that might
be running? For example, if my VBA code performs a copy and it goes to the
clipboard, and then another application performs a copy to the clipboard
before I can get in there with my Paste, will I end up pasting the other
applications clipboard data?

My program needs to copy an entire section from one document over into
another document. Perhaps there is a way of doing this without using the
clipboard?

Thanks for any tips you can give me.



Robin
 
J

Jonathan West

Robin Tucker said:
Is copy/paste using VBA safe with respect to other applications that might
be running? For example, if my VBA code performs a copy and it goes to the
clipboard, and then another application performs a copy to the clipboard
before I can get in there with my Paste, will I end up pasting the other
applications clipboard data?

Yes, you will. The clipboard is shared across applications, that is what it
is there for.
My program needs to copy an entire section from one document over into
another document. Perhaps there is a way of doing this without using the
clipboard?

Yes there is. Look up the FormattedText property in the Word VBA Help. There
is a code sample that describes what you need to do.
 
M

Malcolm Smith

Is copy/paste using VBA safe with respect to other applications that
might be running?


Robin

I would try to avoid doing this; the user may have something in the
clipboard which they won't want overwriting.

After all, our aim is to make life easier for the user.

- Malc
 

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