473,378 Members | 1,360 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

MSFLXGRD and Excel

I am trying to copy the cell contents in an MSFLXGRD control (using
VB5) into Excel, retaining the foreground colors of the text and
numbers.

I have tried using the Clipboard.SetText msflxgrd1.Clip command, but
that ignores the colors.

I have tried to write rtf-coded text to the clipboard using:

Clipboard.SetText rtf_Text, -16639

where rtf_text is text with rtf commands imbedded, but that does not
work (even though it appears fine in Word), even though the SetText
Method notes say that:

object.SetText data, format

Settings for format are:
---------------------------------
vbCFRTF &HBF01 RichText Format

should copy text to the clipboard in rtf format. Excel does not
recognize that anything is on the clipboard when this instruction is
executed.

All I want to do is highlight cells in the MSFLXGRD with the left
mouse button, then write that data to the clipboard (including
foreground colors) using the Mouse UP Event, so I can then go to Exel
and paste the cells into a workbook in any location I desire.
Thank you.

Oct 18 '05 #1
3 10176

"Otie" <ot*********@adelphia.net> wrote in message
news:3O********************@adelphia.com...
I am trying to copy the cell contents in an MSFLXGRD control (using
VB5) into Excel, retaining the foreground colors of the text and
numbers.

I have tried using the Clipboard.SetText msflxgrd1.Clip command, but
that ignores the colors.

I have tried to write rtf-coded text to the clipboard using:

Clipboard.SetText rtf_Text, -16639

where rtf_text is text with rtf commands imbedded, but that does not
work (even though it appears fine in Word), even though the SetText
Method notes say that:

object.SetText data, format

Settings for format are:
---------------------------------
vbCFRTF &HBF01 RichText Format

should copy text to the clipboard in rtf format. Excel does not
recognize that anything is on the clipboard when this instruction is
executed.

All I want to do is highlight cells in the MSFLXGRD with the left
mouse button, then write that data to the clipboard (including
foreground colors) using the Mouse UP Event, so I can then go to Exel
and paste the cells into a workbook in any location I desire.


I think you are out of luck. Try typing some text in Word, and make one word red
and another bold, then select the text and click Copy.
Switch to Excel, and click on Edit, Paste Special. On my machine, it is apparent
that Excel is only willing to paste as an embedded object, a metafile, or as
plain text without formatting. I don't think there is any provision in Excel to
paste text with formatting, especially into multiple cells.

You may have to write your own code using Excel automation, and transfer the
text cell by cell, and the formatting cell by cell.
Oct 19 '05 #2
>> You may have to write your own code using Excel automation, and
transfer the
text cell by cell, and the formatting cell by cell.

Yes, I believe you are right.

Here's where I am stumped.

Assumption: the spreadsheet I want to copy to is already open.

How do I set up something that takes the highlighted active cell in
the spreadsheet, then copies the grid data into it. I can do all the
copying no problem. What I can't seem to do is set up my objects, etc.
from an already-open spreadsheet. Below is some of the code I am
fiddling with:

Dim oApp as Excel.Application
Dim mybook As Workbook
Dim mysheet As Worksheet
Dim xl As Object

'don't know if I need to do this - I may just need Set oApp =
Excel.Application
Set xl = CreateObject("Excel.Sheet")

'but the spreadsheet is already open and the name could be anything
Set mybook = Application.Workbooks.Open(App.path &
"\Test.xls")

MsgBox "The name of the active sheet is " & ActiveSheet.Name

Set mysheet = mybook.Worksheets(ActiveSheet.Name)
Worksheets(ActiveSheet.Name).Activate
current_col% = ActiveCell.Column - 1
current_row% = ActiveCell.row - 1

I am okay from here, if I can get the above to work properly.
Thanks.
Odie


"Steve Gerrard" <my********@comcast.net> wrote in message
news:M5********************@comcast.com...

"Otie" <ot*********@adelphia.net> wrote in message
news:3O********************@adelphia.com...
I am trying to copy the cell contents in an MSFLXGRD control (using
VB5) into Excel, retaining the foreground colors of the text and
numbers.

I have tried using the Clipboard.SetText msflxgrd1.Clip command, but that ignores the colors.

I have tried to write rtf-coded text to the clipboard using:

Clipboard.SetText rtf_Text, -16639

where rtf_text is text with rtf commands imbedded, but that does not work (even though it appears fine in Word), even though the SetText Method notes say that:

object.SetText data, format

Settings for format are:
---------------------------------
vbCFRTF &HBF01 RichText Format

should copy text to the clipboard in rtf format. Excel does not
recognize that anything is on the clipboard when this instruction is executed.

All I want to do is highlight cells in the MSFLXGRD with the left
mouse button, then write that data to the clipboard (including
foreground colors) using the Mouse UP Event, so I can then go to Exel and paste the cells into a workbook in any location I desire.
I think you are out of luck. Try typing some text in Word, and make

one word red and another bold, then select the text and click Copy.
Switch to Excel, and click on Edit, Paste Special. On my machine, it is apparent that Excel is only willing to paste as an embedded object, a metafile, or as plain text without formatting. I don't think there is any provision in Excel to paste text with formatting, especially into multiple cells.

You may have to write your own code using Excel automation, and transfer the text cell by cell, and the formatting cell by cell.

Oct 19 '05 #3
My biggest problem with reading data from an excel spreadsheet, from what I've seen, is you have to know what the first value in each cell is. I have wrote an app to stream data from excel to a csv but I couldn't find a way to do it with out knowing the first field name.
Oct 25 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
0
by: CLarkou | last post by:
My program in Access 2000 was installed on Windows XP. There was a problem with a form including MSFLXGRD.OCX. User unregistered the OCX with REGSVR32 but when he tried to register it the error...
2
by: CLarkou | last post by:
MSFLXGRD.OCX (version 6) was first registered on Windows XP (Office 2000) with a setup for installing an access MDE. It was unregistered with REGSVR32. While trying to registering it again an...
6
by: Matthew Wieder | last post by:
I have the following requirements: Build a stand-alone C# application that asks the user to click in a cell in an Excel spreadsheet, and then displays the address of that cell in the C#...
14
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
0
by: sridev | last post by:
hi all, I am using a setup program to install an app on another computer, how can have the setup file to automatically register the msflxgrd.ocx. Plz help me........ Its urgent...... with...
1
by: jonnoelrob | last post by:
I am developing an Access 2003 app on XP Pro, I am using Treeviews, FlexGrids etc. etc. (All version 6 Service Pack 6) These all work no problem on my dev machine, but when I put the app on the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.