Results 1 to 2 of 2
  1. #1
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97

    How to copy text to clipboard WITHOUT Microsoft Forms 2.0 Object Library?

    Hello all, struggling government programmer again. I'm trying to make a button that will copy text to the clipboard so I can paste it into a PDF file for routing sheets. However the guides say I need Microsoft Forms 2.0 Object Library, which I do not have nor can I get installed on these computers. So I need an "alternative" way to do it.



    I'm wondering if there's a way to have VBA select the contents of a form field (Which I'll set to the text string I want) and send the "Copy to clipboard" command.

    Edit

    SOLUTION: Used DoCmd.RunCommand acCmdCopy to copy the field with current focus, and a previous command to set the focus to the field with the text.


    I tried the following, none of which worked

    Code:
    Dim clipboard As MSForms.DataObject
    Set clipboard = New MSForms.DataObject
    clipboard.SetText "A string value"
    clipboard.PutInClipboard
    
    
    Dim ObjRoutingSheet As New DataObject
    Dim StrRoutingSheetText As String
    StrRoutingSheetText = Me.Identification & " packet for " & Me.Event & " on " & Me.DateStart & " in " & Me.Location & "."
    ObjRoutingSheet.SetText StrRoutingSheetText
    ObjRoutingSheet.putinclipboard
    
    
    Dim myClipboard As New vbaClipboard  ' Create clipboard
    ' Copy text to clipboard as ClipboardFormat TEXT (CF_TEXT)    
    myClipboard.SetClipboardText "Text to put in clipboard", "CF_TEXT"

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    So this is truly resolved?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Microsoft Outlook Object Library 16.0
    By hinchi1 in forum Access
    Replies: 12
    Last Post: 12-09-2017, 02:02 PM
  2. Microsoft Office 14.0 Object Library
    By MatthewR in forum Programming
    Replies: 4
    Last Post: 07-29-2016, 10:05 AM
  3. btn macro what can copy text to clipboard
    By TriFith in forum Import/Export Data
    Replies: 6
    Last Post: 07-01-2016, 02:45 AM
  4. Replies: 7
    Last Post: 11-13-2014, 07:46 AM
  5. Replies: 1
    Last Post: 03-13-2010, 08:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums