Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default A doubt on worksheet.CustomProperties...

hi all, please help me with this. This is so very annoying and am not able to
solve :(

I am getting an error while trying to add a name-value pair to the excel
sheet's custom properties. The exception says: Exception from HRESULT:
0x800A03EC
I tried googling about this but to no use.

The surprising element is,

MySheet.CustomProperties.Add(Name,Value); //Name--string, Value-- any object

When the object is a simple object which has some ints, doubles, strings etc
such basic data types, it is working fine. How ever in my application, I want
to add 'sample' class' objects to the sheet's custom properties.

The 'sample' class is as shown:

class sample
{
OLEObject o;
Shape btn;
private Worksheet sht;
MSForms.CommandButton mbtn_1;
private static object Opt = Type.Missing;
Range act;
public string name;

public sample(string s)
{
name = s;
sht = (Worksheet)Connect.MyApplication.ActiveSheet;
act = Connect.MyApplication.ActiveCell;
btn = sht.Shapes.AddOLEObject("Forms.CommandButton.1",
Opt, Opt, Opt, Opt, Opt, Opt,
sht.get_Range(act, act).Left,
sht.get_Range(act, act).Top,
sht.get_Range(act, act).Width,
((double)sht.get_Range(act, act).
Height) * 2);
o = (OLEObject)btn.DrawingObject;
mbtn_1 = (MSForms.CommandButton)(o.Object);
mbtn_1.Caption = "search";
mbtn_1.Click += new
MSForms.CommandButtonEvents_ClickEventHandler(sear ch_me);
}
public void search_me()
{
act.Cells[1, 2] = name;
}
}


When am trying to add a custom property with a value as an object of sample
class, I am getting this exception(Exception from HRESULT: 0x800A03EC ). Can
anyone here tell me where the mistake lies?! Or is it allowed in the first
place to add any object that contains things like MSForms.CommandButton etc!?
because, it gives me no exception if am trying to add an object with basic
datatypes such as ints and strings.

Thanks in advance.

Regards.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CustomProperties Bob[_77_] Excel Programming 2 September 23rd 08 11:17 PM
WorkSheet customproperties Nay Excel Programming 1 September 11th 07 04:40 PM
I have a doubt! Jaleel Excel Discussion (Misc queries) 4 September 21st 06 01:51 PM
Worksheet.CustomProperties Derrick[_3_] Excel Programming 4 April 2nd 05 06:25 PM
some doubt mango Excel Worksheet Functions 6 December 31st 04 01:42 PM


All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"