I have several .lnk files on my desktop that fetch data from other files that I use in my database. These files copy data to the clipboard that I then paste into the displayed form. I want to do this in Access VBA, rather then jumping to the desktop and clicking on the file.
Asked
Active
Viewed 228 times
2 Answers
0
You can use WScript to execute.LNK
files.
Sub ExecuteLink(ByVal Path As String)
Const dQuote As String = """"
With CreateObject("Wscript.shell")
.Run dQuote & Path & dQuote, 4, True
End With
End Sub
But you still have to paste the clipboard data (can be automated too).
Instead fetching data (from a query?) to clipboard, fetch data in VBA and insert it to the form.
If you can't automate the selected field to insert you can use a context menu entry to select a control and execute the VBA-Code.

ComputerVersteher
- 2,638
- 1
- 10
- 20
-
Thank you for Wscript. This solves half of my problem. Next: How to wait for the hidden executable in the ,lnk file to end? – Roy Aug 30 '19 at 05:28
-
As [bWaitOnReturn](https://ss64.com/vb/run.html) is true, it should do that, but using vba instead of lnk would solve that too. – ComputerVersteher Aug 30 '19 at 05:55
0
As this is getting to complicated, I am going to start a new simpler thread on running "Microsoft Solitaire Collection" using Access VBA.

Roy
- 1