Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Com for use by Access/Excel

Status
Not open for further replies.

croydon

Programmer
Apr 30, 2002
253
EU
I have been trying to create a Class Library that can be used by both VB.NET and Access 2003.

For VB.NET, the dll lets me view the properties and functions as expected. The problem is with Access.

I went through the documented process of creating a Com Callable Wrapper and created a tlb file. The process I went through to produce this was to create a .snk file, and run tlbexp, regasm and gacutil (with what I assume were the correct parameters).

I then opened Access, created a form and a button and in VBA added a reference to my class by browsing for the .tlb file. All ok so far and no errors reported.

I then created a new object based on my class (Dim newobj as new encryption.class). My class appeared in the dropdown list as expected.

However, when I try to work with the class, none of the properties or functions are available. I checked the Object Explorer and my class appears in the Library list but none of it's members are displayed.

The class I have created is to encrypt and decrypt strings.

Any suggestions would be appreciated.


 
For anyone that's interested......

There was nothing actually wrong with the COM object.

The confusion was caused because the objects members were not displayed in the Object Browser, and in VBA intellisense did not display the object's methods (why is this?).

When coded without intellisense the functions worked as expected.
 
Did you ever discover an answer/reason for this? I am starting a similar project.

Also, where did you find the docs on creating a Com callable wrapper - on Microsoft's site or elsewhere?

I'm just starting to look but found this post.

Thanks.

Matthew Moran (career blog and podcast below)
Career Advice with Attitude for the IT Pro
 
Do a search for REGASM. That's the tool that creates the .TLB file. The TLB file is kinda like a COM based header that points to the .Net DLL file.

I ran into similar issues in that I can get the COM app to work with the .TLB file, but I have never been able to get intellisense working.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
mmorancbt, to create the wrapper, I based my project on the instructions at:


I was not able to resolve the intellisense issue. I assume there must be some compatability problem. To begin with, I debugged my way through the code to ensure the com was working as expected.
 
I'm not positive, but I think to create a COM object for Excel/Access that you need to make the Methods/Properties/Functions & Subs as Public Shared in order for them to show up in the VBA Intellisense.

I hope this helps.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top