Get text from clipboard

R

Rene Petersen

Can anyone help me on this one please.

I am creating a inputbox and I want the default text of the inputbox to be
the text I just copied.

Dim Search
Search = InputBox("Type your search", "Search", CLIPBOARDTEXTHERE)

Thanks,
Rene
 
C

chijanzen

you can use SendKeys

Range("A1").Copy
Application.SendKeys "^V"
Search = InputBox("Type your search", "Search")
 
T

Tony Jollans

Have you just copied the text in code yourself? Or are you relying on the
user having done it?

If you've done it on code, you should already know what you've copied. If
you're relying on the user you will have to allow for the fact that they may
not have done it and the clipboard may be empty or may contain non-textual
data (but the DataObject is still probably the thing to use).
 

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