VBA PutInClipboard suddenly stopped working -

Johnny C

Well-known Member
Joined
Nov 7, 2006
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
Hi

Just been away for a week. Until I went way this has worked for years. Now it's just returning 2 ASCII 63's. I checked, MS forms 2.0 and Microsoft Excel 15 Objects are both included in References, can anyone spot why it's not working? it's just an icon on the QAT which copies in the workbook refs and puts them into the clipboard so I can paste as text elsewhere.

Code:
Sub CopyDocPathName()
Dim DataObj As New MSForms.DataObject
Dim SheetNarr$, TempPlural$
Dim SelectedObject As Variant
If ActiveSheet.Type = xlWorksheet Then
    If TypeName(Selection) = "Range" Then
        If Selection.Cells.Count = 1 Then TempPlural = "" Else TempPlural = "s"
        SheetNarr = "Data source: " & ActiveWorkbook.Path & "\" & ActiveWorkbook.Name & " Tab [" & ActiveSheet.Name & "] Cell" & TempPlural & " " & Selection.Address
    End If
End If
DataObj.SetText SheetNarr
DataObj.PutInClipboard
End Sub

TIA
 
Last edited:

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hi Mick
It works fine with File Explorer open.
I tracked it down to going wonky when I had 2 instances of Excel open, a regular instance (i.e. installed program) and an instance of Excel on Citrix (which has an Infor Q&A add-in). I should have known, Infor Q&A gets uppity when you have more than one workbook open even if you're working on the non-Citrix instance. I don't know why it does, you'd have thought they were totally independent but it seems not, the Q&A session must hog some common resource in the registry or something.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top