473,666 Members | 2,060 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.SetTe xt msflxgrd1.Clip command, but
that ignores the colors.

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

Clipboard.SetTe xt 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 10193

"Otie" <ot*********@ad elphia.net> wrote in message
news:3O******** ************@ad elphia.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.SetTe xt msflxgrd1.Clip command, but
that ignores the colors.

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

Clipboard.SetTe xt 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.Applicati on
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.Applicati on
Set xl = CreateObject("E xcel.Sheet")

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

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

Set mysheet = mybook.Workshee ts(ActiveSheet. Name)
Worksheets(Acti veSheet.Name).A ctivate
current_col% = ActiveCell.Colu mn - 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********@com cast.net> wrote in message
news:M5******** ************@co mcast.com...

"Otie" <ot*********@ad elphia.net> wrote in message
news:3O******** ************@ad elphia.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.SetTe xt msflxgrd1.Clip command, but that ignores the colors.

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

Clipboard.SetTe xt 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
UKtheBunny
3 New Member
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
35524
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 and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
3
20275
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 (MyXL). It uses the worksheet's Application property to make Microsoft Excel visible, to close it, and so on. Using two API calls, the DetectExcel Sub procedure looks for Microsoft Excel, and if it is running, enters it in the Running Object Table. The...
0
2972
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 "DllRegisterServer in MSFLXGRD.OCX failed" appeared. I asked him to uninstall and install the program again since the OCX is included in the setup but similar error appeared. What could be the problem ?
2
14147
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 error appears "DLLRegisterServer in msflxgrd.ocx failed. Return code was: 0x8002801c". 8002801c means "error accessing the OLE registry".
6
12490
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# application. It seems simple enough, but the problem I'm encountering is as follows: In order for the user to select the cell from Excel, they must first click once on the Excel window to give it focus and then their second click is what changes the cell...
14
5784
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 SQL DATABASE, probably by the click of a button. Is this possible? & what is the BEST APPROACH for doing this? & also if any links are there do tell those to me too coz I have no idea how to go about doing it.
0
1504
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 regards, Sridev
1
4458
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 users machines everything works OK except for MSFLXGRD.OCX. The users machines are XP Pro, with all OCX's installed and all the correct versions. I wrote a VB app with the same MSFLXGRD on it. Installed the VB app on the user machines and the MSFLXGRD...
0
8448
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8552
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.