Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Use Dot Net API within VBA

Posted on 2011-09-02
8
Medium Priority
?
510 Views
Last Modified: 2012-05-12
I have an API for Dot Net and I'm hoping there's a way to run it within VBA (MS Access or Excel).

The API controls functionality of another system. It also relies heavily on Event Handlers for events triggered by that other system. I'm hoping there's a way my vba code can actually react to those events.

Doable? Can you guide me to some good reference sources or tutorials? Or, even better, summarize the steps.

Thanks!
0
Comment
Question by:Kaprice
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 36472339
Sorry for you, this won't be possible.

It can work in some instances, when the programmer who wrote the API takes into account the fact that it will be called by VBA. They usually don't.

It is hard to connect to simple things in a .NET dll from VBA because the differences between both systems are huge. For instances, dates do not work well because they are not in the same format.

And events are not the same thing at all. They are not declared, nor called, nor handled in in the same way. So subscribing to the events is not possible.

It would be a lot to thing that a Technology that is 20 years old could talk to another one that was developed a dozen of years later. Microsoft could not foresaw .NET when they developed VBA.

0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 36473189
Perhaps you could describe this mysterious "API" for us...?

Perhaps there is something similar in VBA?
0
 

Author Comment

by:Kaprice
ID: 36475264
Perhaps you could describe this mysterious "API" for us...?

Perhaps there is something similar in VBA?

Not likely. It's an interface for controlling another proprietary app.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Kaprice
ID: 36475279
Someone elsewhere suggested the possibility of creating a "wrapper" COM object in Dot Net.  Not sure how practical or challenging that would be, but if anyone has any ideas on how one could do that, I'm open to it.
0
 
LVL 40
ID: 36475465
Wrapper COM objects are created in C++, the only language that permits the use of pointers in the .NET development environment.

If you know somebody who knows C++, how to use it in .NET, as well as the inner workings of COM...

As suggested by Kaprice, there might be something similar in VBA. If the API is a third party API, maybe they had an equivalent version in COM before the arrival of .NET in 2002.
0
 
LVL 75
ID: 36476348
Is there an Object Model for this API / App ?

"As suggested by Kaprice,"
Kaprice is the OP :-)

mx
0
 

Author Comment

by:Kaprice
ID: 36476406
Is there an Object Model for this API / App ?

It doesn't appear so. After installing the API, I looked through the reference list and it wasn't there, so I can't do it the traditional way.


"As suggested by Kaprice,"
Kaprice is the OP :-)

I think he saw me quote the guy who said that and took it as my own. :)
0
 
LVL 75
ID: 36476534
Is there some OCX / DLL or whatever ... such that you can set a reference to it from the VBA References ?  If so, then you can probably see what methods and properties are available.

mx
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question