Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Using c# object in Excel VBA

Hi All
I have writen an COM Object in C# to use it in Excel. This Object has a
Function that delivers a List of Users from a Database. My problem is now
that I get the List of Users but it is not posible to get one of the
Properties of the User. But when I create a new Object with
Set user = CreateObject("GuptaIntferface.UserVOCom")
I can see all Properties of this object. My Question is now how can I tell
VBA now that the objects in the List are the UserVOCOM Objects?
thx for help
Michael
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,203
Default Using c# object in Excel VBA

I'm kind of stabbing the dark on this one as I've never worked with a C#
object. But have you tried:
msgbox user.propertyname
which would print the value of the propertyname you provide in a message box
on screen. Just put that line right after your Set user = CreateObject(....)
statement and give it a go.

I say that I'm stabbing at it, because that's the way you'd reference a
property in a typical object as:
Set myRange = Range("B1:B9")
msgbox myRange.Rows.Count
would show a 9.

If user is a list you may have to reference the item in the list as:
msgbox user(1).propertyname


"Michael" wrote:

Hi All
I have writen an COM Object in C# to use it in Excel. This Object has a
Function that delivers a List of Users from a Database. My problem is now
that I get the List of Users but it is not posible to get one of the
Properties of the User. But when I create a new Object with
Set user = CreateObject("GuptaIntferface.UserVOCom")
I can see all Properties of this object. My Question is now how can I tell
VBA now that the objects in the List are the UserVOCOM Objects?
thx for help
Michael

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default Using c# object in Excel VBA

Can you set a reference in the VBE to your library ?

Tim


"Michael" wrote in message
...
Hi All
I have writen an COM Object in C# to use it in Excel. This Object has a
Function that delivers a List of Users from a Database. My problem is now
that I get the List of Users but it is not posible to get one of the
Properties of the User. But when I create a new Object with
Set user = CreateObject("GuptaIntferface.UserVOCom")
I can see all Properties of this object. My Question is now how can I tell
VBA now that the objects in the List are the UserVOCOM Objects?
thx for help
Michael



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Using c# object in Excel VBA

thx for the Results
@Tim: Yes I allready added the reference
@JLatham: I had the some Idea like you with user(1).propertyname but then I
get the Error Message Runtime Error 424 Object necessary

I tried the following lines and all lines failed :(
user2 = Users(i)
objSheet.Range(cell).Value = Users(i).UserName
objSheet.Range(cell).Value = user2.UserName
thx for Help Michael

Here is my complete Code:

Sub Schaltfläche2_BeiKlick()
Set obj = CreateObject("GuptaIntferface.Wrapper")
Set objSheet = Worksheets("Tabelle1")
UserName = objSheet.Range("B1").Value
Password = objSheet.Range("B2").Value
workspace = objSheet.Range("B3").Value
mandant = objSheet.Range("B4").Value
resultnix = obj.InitWrapper(UserName, "", workspace, mandant)
resultnix = obj.RegisterHostaddress("Ibs.Infrastructure",
"http://localhost/Infrastructure.Host/")
result = obj.Test()
Users = obj.GetUserList()
Set user = CreateObject("GuptaIntferface.UserVOCom")
MsgBox user.UserName
For i = 1 To UBound(Users)
cell = "B" + CStr(i + 10)
user2 = Users(i)
objSheet.Range(cell).Value = Users(i).UserName
objSheet.Range(cell).Value = user2.UserName
Next i
MsgBox result
End Sub
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
Object Library invalid or contains references to object defintions John Excel Programming 1 July 24th 09 11:00 AM
2 Label Options - Forms Object vs Control Box Object Awrex Excel Discussion (Misc queries) 3 July 17th 09 07:10 PM
Can I get a chart object (excel.ChartObject) from OLE_chart.object chris Excel Programming 4 December 16th 08 08:36 AM
Option button object proeprties or object not found in vba Pete Straman S via OfficeKB.com Excel Programming 0 August 31st 05 05:49 PM
Confusion about how the Window object fits into the Excel object model Josh Sale Excel Programming 11 April 15th 05 06:08 PM


All times are GMT +1. The time now is 09:30 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"