Copy strPath to clipboard (1 Viewer)

Anyone have any idea as to why one cannot just remove this reference, like one can for others?
What I worked out years ago was although Access doesn't use MSForms directly there references to bits of it which it does use so as soon as you open any form those are in memory 'in use'.
 
Not quite accurate. it seems to load in the background whether or not there are any forms (open or otherwise). See my example in post #12
 
Not quite accurate. it seems to load in the background whether or not there are any forms (open or otherwise). See my example in post #12
I obviously didn't explain myself properly! The VBA IDE is common across all Office applications and it's the references dialog itself (which uses the underlying MSForms technology) that is causing the problem. The MSForms.dll is just the entry points for the technology and the dialog can't tell the difference.
 
Already using a string called strPath in a VBA. Just can't figure out how to copy that strPath to the clipboard so I can just ctr-paste outside of Access.
Is there a one liner that can do this?
I may be late to this thread, but I got this simple code from the spreadsheet guru blog which works well.

Code:
' Copy StoreText if not emplty to clipboard and return vbnullstring
' Return clipboard text if StoreText is empty
' Early bind using ref to Microsoft HTML Object Library
Public Function Clipboard(Optional ByVal ClipboardText As String = vbNullString) As String
    'PURPOSE: Read/Write to Clipboard
    'Source: ExcelHero.com (Daniel Ferry)
    'blog/2015/1/13/how-to-use-vba-code-to-copy-text-to-the-clipboard
    On Error GoTo errpClipboard
    Dim ReturnValue As String
    Dim X As Variant 'Store as variant for 64-bit VBA support

    X = ClipboardText
'    With New HTMLDocument ' Early binding
      With CreateObject("htmlfile")
        With .parentWindow.clipboardData
          Select Case True
            Case Len(ClipboardText)
                'Write to the clipboard
                .SetData "text", X
            Case Else
                'Read from the clipboard (no variable passed through)
                ReturnValue = .GetData("text")
          End Select
        End With
      End With
donepClipboard:
    On Error Resume Next
    Clipboard = ReturnValue
    Exit Function
errClipboard:
    debug.print "Clipboard error: " & Description
    Resume doneClipboard
End Function
 

Users who are viewing this thread

Back
Top Bottom