VBA to clipboard then clipboard:

mtheriault2000

Well-known Member
Joined
Oct 23, 2008
Messages
826
Hello

I use some code to copy a cell value to the clipboard.

If I copied back the clipboard to NotePad, the proper value is copied
If I tried to copy the value to an Excel cell, I'm getting an error

Extract of the code

Note:
- All variables had been previously define. Only the clipboard part is in fault here

Code:
Dim DataObj As New MSForms.DataObject
Dim S As String
    
   Created_Zone_Info_ = "Zone #:" & VBA.STR(Num_String) & VBA.Space(3) & "LONG " & Z_Market_Scale & VBA.Space(3) & _
                         "Entry:" & Z_Entry & VBA.Space(3) & _
                         "Stop:" & Z_Stop & VBA.Space(3) & "LMT"
                         
 S = Worksheet.Function.Clean(Created_Zone_Info_.Value)
 DataObj.SetText S
 DataObj.PutInClipboard
    
' Create a string to represent a new Bar Info
End Sub
 
Last edited:

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Hum, hello ......

I think you got a problem


I know... lol

Just saw that thee error showed is related to the security setup for Excel

The data copied is from Excel and I want to paste it to an Excel cell...
I can paste the clipboard content to a text file and the string is flawless
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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