Link to home
Start Free TrialLog in
Avatar of Shaun Wingrin
Shaun WingrinFlag for South Africa

asked on

Excel - copy string to clipboard

Say, I don't want to copy from a cel - but rather the text in a string - its a password that needs to be put in the clipboard. I'm using a macro/VBA code.
SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try the following

Dim clipboard As MSForms.DataObject
Set clipboard = New MSForms.DataObject
clipboard.SetText "PASSWORD"
clipboard.PutInClipboard
Avatar of Shaun Wingrin

ASKER

I don't see the reference listed for:
'Microsoft Forms 2.0 Object Library"
Using Excel 2013
say I found it by searching for file mf20.dll
However the code doesn't work...
mankowitz
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
seems I needed to change to clipboard1 as clipboard was reserved??
I also dimmed the text as a string but doubt this is needed.