Welcome to MacForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

putInClipboard method errors on mac

 
   Macintosh computer (Home) -> Excel RSS
Next:  Can't get 0 Right Margin  
Author Message
subra

External


Since: Nov 12, 2003
Posts: 2



(Msg. 1) Posted: Wed Nov 12, 2003 10:40 am
Post subject: putInClipboard method errors on mac
Archived from groups: microsoft>public>mac>office>excel (more info?)

putInClipboard method of the DataObject is putting some invisible
characters on clipboard at the end of the string. I can see these
characters when i paste the clipboard conetents in BBedit. This
happens only on Mac (OSX). I don't have any problem on windows. I
figured out that for every character in the string one invisible
character is added at the end plus two ( if i have 10 character
string, there are 12 invisible characters). Also when I use GetText I
don't get anything. Following is my test code. I appreciate any
suggestions.

Dim data As DataObject
Dim text, rs As String

For i = 1 To 100 Step 1
text = text & "hello"
Next

Set data = New DataObject
data.SetText text
data.PutInClipboard

data.GetFromClipboard
rs = data.GetText
' no text in my immediate window
Debug.Print rs

 >> Stay informed about: putInClipboard method errors on mac 
Back to top
Login to vote
J.E. McGimpsey

External


Since: Dec 25, 2003
Posts: 551



(Msg. 2) Posted: Wed Nov 12, 2003 5:25 pm
Post subject: Re: putInClipboard method errors on mac [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <4b28eff8.0311120740.a6d1a61.TakeThisOut@posting.google.com>,
subrahmanyam.kunala.TakeThisOut@regeneron.com (subra) wrote:

 > putInClipboard method of the DataObject is putting some invisible
 > characters on clipboard at the end of the string. I can see these
 > characters when i paste the clipboard conetents in BBedit. This
 > happens only on Mac (OSX). I don't have any problem on windows. I
 > figured out that for every character in the string one invisible
 > character is added at the end plus two ( if i have 10 character
 > string, there are 12 invisible characters). Also when I use GetText I
 > don't get anything. Following is my test code. I appreciate any
 > suggestions.
 >
 > Dim data As DataObject
 > Dim text, rs As String
 >
 > For i = 1 To 100 Step 1
 > text = text & "hello"
 > Next
 >
 > Set data = New DataObject
 > data.SetText text
 > data.PutInClipboard
 >
 > data.GetFromClipboard
 > rs = data.GetText
 > ' no text in my immediate window
 > Debug.Print rs

I can reproduce your results in PutInClipboard, except that I get
the invisible characters plus one extra character, not two (all
Unicode 255). I don't know if this has been bugged before, but I'll
submit it. Please do likewise, using XLv.X's Help/Send Feedback
feature.

AFAIK, the GetText problem's been a bug in MacXL since XL98. I know
that I and others have reported the problem, so perhaps the next
version...

In the mean time, the best workaround I've found is to paste the
contents of the clipboard into a cell in a new workbook, read it
into a string variable, then delete that workbook.

Depending on what you're doing, of course, you may not need to. The
Mac clipboard is persistent - Application.CutCopyMode = False does
not clear it - so you may not need to read it into a dataobject at
all.

For a macro that *does* clear the Mac clipboard, see

<a style='text-decoration: underline;' href="http://www.mcgimpsey.com/excel/clearclipboard.html" target="_blank">http://www.mcgimpsey.com/excel/clearclipboard.html</a><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: putInClipboard method errors on mac 
Back to top
Login to vote
subra

External


Since: Nov 12, 2003
Posts: 2



(Msg. 3) Posted: Fri Nov 14, 2003 11:11 am
Post subject: Re: putInClipboard method errors on mac [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for your suggestion. I am not bothered whether clipboard is
cleared or not. For my purpose, I need to get data from a selection
and modify it in a format I wanted and put it in the clipboard so that
another application can take that data. There is no other way for me
to pass that data to that application. This bug occurs only on Mac OSX
excel and it is fine on Mac OS9 and on Windows. I think the problem is
in "putInClipboard method of DataObject. If I just copy with short cut
keys (or from menu) and pasting into BBEdit i don't see any extra
characters.




"J.E. McGimpsey" <jemcgimpsey.TakeThisOut@mvps.org> wrote in message news:<jemcgimpsey-592D64.14255112112003.TakeThisOut@msnews.microsoft.com>...
 > In article <4b28eff8.0311120740.a6d1a61.TakeThisOut@posting.google.com>,
 > subrahmanyam.kunala.TakeThisOut@regeneron.com (subra) wrote:
 >
  > > putInClipboard method of the DataObject is putting some invisible
  > > characters on clipboard at the end of the string. I can see these
  > > characters when i paste the clipboard conetents in BBedit. This
  > > happens only on Mac (OSX). I don't have any problem on windows. I
  > > figured out that for every character in the string one invisible
  > > character is added at the end plus two ( if i have 10 character
  > > string, there are 12 invisible characters). Also when I use GetText I
  > > don't get anything. Following is my test code. I appreciate any
  > > suggestions.
  > >
  > > Dim data As DataObject
  > > Dim text, rs As String
  > >
  > > For i = 1 To 100 Step 1
  > > text = text & "hello"
  > > Next
  > >
  > > Set data = New DataObject
  > > data.SetText text
  > > data.PutInClipboard
  > >
  > > data.GetFromClipboard
  > > rs = data.GetText
  > > ' no text in my immediate window
  > > Debug.Print rs
 >
 > I can reproduce your results in PutInClipboard, except that I get
 > the invisible characters plus one extra character, not two (all
 > Unicode 255). I don't know if this has been bugged before, but I'll
 > submit it. Please do likewise, using XLv.X's Help/Send Feedback
 > feature.
 >
 > AFAIK, the GetText problem's been a bug in MacXL since XL98. I know
 > that I and others have reported the problem, so perhaps the next
 > version...
 >
 > In the mean time, the best workaround I've found is to paste the
 > contents of the clipboard into a cell in a new workbook, read it
 > into a string variable, then delete that workbook.
 >
 > Depending on what you're doing, of course, you may not need to. The
 > Mac clipboard is persistent - Application.CutCopyMode = False does
 > not clear it - so you may not need to read it into a dataobject at
 > all.
 >
 > For a macro that *does* clear the Mac clipboard, see
 >
<font color=purple> > <a style='text-decoration: underline;' href="http://www.mcgimpsey.com/excel/clearclipboard.html</font" target="_blank">http://www.mcgimpsey.com/excel/clearclipboard.html</font</a>><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: putInClipboard method errors on mac 
Back to top
Login to vote
J.E. McGimpsey

External


Since: Dec 25, 2003
Posts: 551



(Msg. 4) Posted: Fri Nov 14, 2003 3:38 pm
Post subject: Re: putInClipboard method errors on mac [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <4b28eff8.0311140811.524a95a3 RemoveThis @posting.google.com>,
subrahmanyam.kunala RemoveThis @regeneron.com (subra) wrote:

 > Thanks for your suggestion. I am not bothered whether clipboard is
 > cleared or not. For my purpose, I need to get data from a selection
 > and modify it in a format I wanted and put it in the clipboard so that
 > another application can take that data. There is no other way for me
 > to pass that data to that application. This bug occurs only on Mac OSX
 > excel and it is fine on Mac OS9 and on Windows. I think the problem is
 > in "putInClipboard method of DataObject. If I just copy with short cut
 > keys (or from menu) and pasting into BBEdit i don't see any extra
 > characters.

I agree, and I've submitted a detailed bug report.

I'm curious as to why you can't use copy to read even a modified
text into the Clipboard. I've done that frequently for passing to
other apps. While I've occasionally used dataobjects, I've very
rarely had the need.

I've also been successful before using Applescript and conditionally
compiled the code for Win (no applescript) and Mac (applescript).<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: putInClipboard method errors on mac 
Back to top
Login to vote
Display posts from previous:   
   Macintosh computer (Home) -> Excel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]