Copy to clipboard

  • Thread starter Thread starter Kerstin Schiebel
  • Start date Start date
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
 
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
 
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
 
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.
 
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
 
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.
 
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
 
Back
Top