Showing posts with label clipboard. Show all posts
Showing posts with label clipboard. Show all posts

Friday, November 20, 2009

API: Copy variables/control contents to memory

I used to have this bookmarked but somewhere along the line I lost it: API: Copy variables/control contents to memory from The Access Web. I stumbled across it today when reading this post on UtterAccess.com.

I have found copying things to and from the clipboard to be a useful feature in several of my applications. Here's one I built in Word. This little macro copies the current document path to the clipboard.

Public Sub PathToClipboard()
    With Application.ActiveDocument
        ClipBoard_SetText .Path & "\" & .Name
    End With
End Sub
(You'll need the code from The Access Web link above in addition to this little snippet.) I found I often had to give a colleague the path to a document I had just updated on a shared drive somewhere. Using this macro I would just hit the keyboard shortcut I had set up, pop over to email, and hit ctrl-v to paste. And there I'd have the full path to the document in my email.

There are lots of other applications for the putting data on the clipboard, so it's a good thing to have in your toolkit- bookmark the post on The Access Web and you'll have it when you need it.