Formatting clipboard text for spreadsheets

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2005
Posts: 32
Reputation: MrConfused is an unknown quantity at this point 
Solved Threads: 0
MrConfused MrConfused is offline Offline
Light Poster

Formatting clipboard text for spreadsheets

 
0
  #1
Aug 5th, 2005
I have a VB program that produces reports by sending text to various list boxes.
I want to add the option to have the reports sent to the clipboard. I imagion most users would then want to paste the information into a spreadsheet.
I have figured out that adding chr$(13) to the end of each line of text will make the text in the clipboard appear on the next line.

1. Is there a character I can add to the string that would make the next part of the string (when pasted into a spreadsheet) appear in the next spreadsheet column.

2. Is there an easy way to send all the text that is already in the list box to the clipboard, or will I have to create a huge string to do this.

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 32
Reputation: MrConfused is an unknown quantity at this point 
Solved Threads: 0
MrConfused MrConfused is offline Offline
Light Poster

Re: Formatting clipboard text for spreadsheets

 
0
  #2
Aug 5th, 2005
Hello, I have found out the answer to my first question. You put chr$(9) in the string, then the next bit of the string appears in the next column. CHR$(9) is the tab character. Anyone able to answer my second question though. Any other tips regarding sending text to the clipboard welcome.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Formatting clipboard text for spreadsheets

 
0
  #3
Aug 7th, 2005
You'll have to create a huge string. As far as I can tell, updating the clipboard with VB6 overwrites what was there previously. Just like if you keep opening a file for output instead of append. The easy solution is to have 1 variable that keeps getting concantenated during a loop, and then assign the clipboard the value of the variable....
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 32
Reputation: MrConfused is an unknown quantity at this point 
Solved Threads: 0
MrConfused MrConfused is offline Offline
Light Poster

Re: Formatting clipboard text for spreadsheets

 
0
  #4
Aug 7th, 2005
Yes, It appears that each time you send text to the clipboard (clipboard.settext Astring$) the previous text is deleted, so adding to it line by line would only leave the last line there! Seems that assembling a huge string is the only obvious option. I already have the code for sending the reports to a listbox, so that will help. I checked out how big a string can be in VB5 and in help is says approx. 2 billion characters so no problem there. Some of the reports will be several thousand charactes long. I hope the clipboard does not have a low limit though!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC