VBA to "Copy" text from a field (1 Viewer)

Leo_Polla_Psemata

Registered User.
Local time
Today, 03:47
Joined
Mar 24, 2014
Messages
364
Hi, I have created a table/form in which i store all of my business app passwords.
I use more than 15 applications, each one requires a password that i must change every 30 or 60 days, different format so, not possible to keep one pass for all.
In the form, i would like to create a button, next to password field, this button i would like, once i click, to copy the password that i will paste in my app.
Do you know which method i must use ?

At this moment, i double click the pass, then right click, copy (or cntr +c) and i paste in the application. Simple but there are several "small" problems.
Today, i made mistake, instead of "cntr+c" i typed "cntr+v" and i pasted the previous text i had on my mouse, i was lucky enouph to spot this out and not save the record.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 03:47
Joined
Oct 29, 2018
Messages
21,454
Hi. Check out the RunCommand method.

Code:
DoCmd.RunCommand acCmdCopy
 

isladogs

MVP / VIP
Local time
Today, 11:47
Joined
Jan 14, 2017
Messages
18,209
Have a look at the code in my example app SQL to VBA & Back Again - Mendip Data Systems

1628170853083.png

This uses APIs to copy selected text to the clipboard, paste from the clipboard and to clear the clipboard
 

MarkK

bit cruncher
Local time
Today, 03:47
Joined
Mar 17, 2004
Messages
8,179
Simplest way I have seen is...
Code:
Sub TextToClipboard(Text As String)
    ' this is a late bound MSForms.DataObject
    With CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
        .SetText Text
        .PutInClipboard
    End With
End Sub
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 06:47
Joined
May 21, 2018
Messages
8,525
If you want some full featured password manager this one works well and is free. I like it much better than other ones I have tried.
Has features to automate filling in web pages and apps with user name and password.
 

Users who are viewing this thread

Top Bottom