Copy to clipboard

K

Kerstin Schiebel

Hi,

is it possible to copy some text into the clipboard via vba?
May be it is a short way to copy some text from an access table into word.

Thanks
Kerstin
 
B

Bas Cost Budde

Kerstin said:
Hi,

is it possible to copy some text into the clipboard via vba?
May be it is a short way to copy some text from an access table into word.

when the control has focus, you can do

runcommand accmdcopy
 
K

Kerstin Schiebel

Hi,

thanks for all answers, i will try them next week.
But the idea is to copy a whole data set not only the content of a text box.
E.g. I select a dataset via a formular and call a macro. This macro should
copy the whole address (first name, last name, institute, ...) via clipboard
into a user defined word document.

Thanks
Kerstin
 
B

Bas Cost Budde

Kerstin said:
Hi,

thanks for all answers, i will try them next week.
But the idea is to copy a whole data set not only the content of a text box.
E.g. I select a dataset via a formular and call a macro. This macro should
copy the whole address (first name, last name, institute, ...) via clipboard
into a user defined word document.

Same answer, different textbox this time. I do the same; upon execution
of the code (you say macro, I don't use macros) I first compose the
'sentence' into the textbox (which I have normally hidden), then do the
Copy command, then hide the textbox again.
 
T

Tim Ferguson

This macro should
copy the whole address (first name, last name, institute, ...) via
clipboard into a user defined word document.

No need to use the clipboard; you can simply use OLE automation to insert
the information direct into the Word document.

If your user has something valuable on the clipboard already, you'd be
pretty unpopular if you trashed it without warning.

B Wishes


Tim F
 
B

Bas Cost Budde

Tim said:
No need to use the clipboard; you can simply use OLE automation to insert
the information direct into the Word document.

Hurray! I didn't dare mention this as I have no idea how; glad you took
this one :-L
If your user has something valuable on the clipboard already, you'd be
pretty unpopular if you trashed it without warning.

Nah. User is asking for function, user got clipboard, why user complain?

Interface consultant, huh? Stupid job you guys got.

I mean, nothing directed to you, Kersten! There are, say, groups of
users with different perceptions of how systems should perform. One type
of user prefers to specify everything, another happily tries everything
and relies on Undo. You cannot design for everyone. Well, not for a
happy everyone.
 
T

Tim Ferguson

Hurray! I didn't dare mention this as I have no idea how; glad you
took this one :-L

set wrd=GetObject("Winword.Application")
set rng=wrd.ActiveWindow.Selection
rng.InsertAfter me!PasteThisTextBox ' or whatever text needs to
' be transferred

set rng=Nothing
set wrd=Nothing

All the best


Tim F
 

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