HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
Go Back  Xtreme Visual Basic Talk > > > HResult=-2147467262 - Unable to cast COM object of type 'System.__ComObject' to inte


Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2013, 03:55 AM
Stephen-Jack Stephen-Jack is offline
Newcomer
 
Join Date: Apr 2013
Location: Live in the UK
Posts: 2
Default HResult=-2147467262 - Unable to cast COM object of type 'System.__ComObject' to inte


My apologises this is my first post - sorry if I haven't followed protocol.

Using VB 2010 I'm trying to extract the individual conditional formatting that have been applied to a cell. There could be more than one so I want to extract the key information for each one. The code below I know works as it does work, however it sporadically fails and I get the above error message.

I have looked on web and the HResult number is a generic error message that doesn't really help. What I have found appears that I need to complete the following:

1 go to the dos prompt in the windows\system directory
2 regsvr32 /u comcat.dll
3 delete comcat.dll, replace with a copy from the vb cd
4 regsvr32 comcat.dll
5 reboot windows and it should work fine
Before I consider completing the above I thought I would post a thread and see what the result were. Any help appreciated.

The code is: and it falls over on defining FC in bold
Code:
 Dim myConditionRule As Integer
        ConditionTotalRule = EXCEL.Worksheets(SheetName).Range(CellAddress).FormatConditions.Count     'Rng.FormatConditions.Count

        For myConditionRule = 1 To ConditionTotalRule
            ConditionNumberProcess = myConditionRule
            With EXCEL.Worksheets(SheetName).Range(CellAddress).FormatConditions(myConditionRule)
             
                FC = EXCEL.Worksheets(SheetName).Range(CellAddress).FormatConditions(myConditionRule)
Many thanks

Last edited by Flyguy; 05-07-2013 at 07:22 AM.
Reply With Quote
  #2  
Old 05-09-2013, 04:24 AM
Stephen-Jack Stephen-Jack is offline
Newcomer
 
Join Date: Apr 2013
Location: Live in the UK
Posts: 2
Default Additional Information

I have completed more work on this issues. I think I have narrowed it down a lot more.

The error message / process falls over when the condition format type is not a Format a cell that contains condition. My additional testing has only been on cell values types and not the other types like:

Specific Text
Dates Occurring
Blanks

The other formatting condition I have tried and the process has failed on are:

Formatting Cells based on their values
Top Ten / Bottom Ten
Above or Below Average
Unique or duplicate values

Any help appreciated. I'm starting to think I will see if I can use the rule manager some how and see if I can read the information that way.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
 
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
HResult=-2147467262  - Unable to cast COM object of type 'System.__ComObject' to inte
 
-->