VBA

Moderators: PavlinII
Number of threads: 1673
Number of posts: 3078

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Macro that copy a cell but always adds an extra charachter?? Posted by mchateau on 3 Jan 2005 at 2:01 AM
Anybody please tell me how to use the activecell.copy or similar to copy the content of the cell without having Excel adding an cariage character mistiriously? It shows when I use CTR-V to paste into another program. If I copy and pase manually from the cell it is fine, but using the macro it is simply adding an extra character!!
Report
Re: Macro that copy a cell but always adds an extra charachter?? Posted by markyc on 3 Jan 2005 at 3:31 PM
: Anybody please tell me how to use the activecell.copy or similar to copy the content of the cell without having Excel adding an cariage character mistiriously? It shows when I use CTR-V to paste into another program. If I copy and pase manually from the cell it is fine, but using the macro it is simply adding an extra character!!
:

I see what you mean.
What you could do is in VBA insert a new UserForm and insert the following code:

Public Sub MyCopy()
Dim MyObj As New DataObject
MyObj.SetText ActiveCell.Value
MyObj.PutInClipboard
End Sub

Then insert a new Module with the following code:

Public Sub CallMyCopy()
UserForm1.MyCopy
End Sub

Then you can setup your shortcut key to use CallMyCopy. Make sure the first code is put in the UserForm since the DataObject object is in the MSForms 2.0 Library.
markyc

I made a new friend today.
Real or imaginary?
Imaginary.





 

Recent Jobs