473,396 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Exposing vb.net procedures

Hi

How can I expose procedures (function or sub) in my vb.net app to vba in
word?

Thanks

Regards
Nov 20 '05 #1
6 1714
* "John" <jo**@nospam.infovis.co.uk> scripsit:
How can I expose procedures (function or sub) in my vb.net app to vba in
word?


Please do not make excessive use of X-posts.

You can make classes and methods visible to COM and use the DLL within
your VBA application. You will find a sample for using a .NET DLL from
within VB6 here:

<http://www.mvps.org/dotnet/dotnet/samples/codingtechnique/downloads/MyComLib.zip>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Hi John,

The VB.NET project must be saved as an ActiveX DLL. Then you can access the
DLL either by setting a reference in Tools References in the VBA editor, or
by using late binding, and creating an object variable with the reference
using the CreateObject command.

--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:Oe**************@TK2MSFTNGP10.phx.gbl...
Hi

How can I expose procedures (function or sub) in my vb.net app to vba in
word?

Thanks

Regards


Nov 20 '05 #3
Hi

How do I save the vb.net app as activex dll? Is activex dll supported in
..net apps?

Thanks

Regards

"Jonathan West" <jw***@mvps.org> wrote in message
news:u5****************@TK2MSFTNGP12.phx.gbl...
Hi John,

The VB.NET project must be saved as an ActiveX DLL. Then you can access the DLL either by setting a reference in Tools References in the VBA editor, or by using late binding, and creating an object variable with the reference
using the CreateObject command.

--
Regards
Jonathan West - Word MVP
http://www.multilinker.com
Please reply to the newsgroup

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:Oe**************@TK2MSFTNGP10.phx.gbl...
Hi

How can I expose procedures (function or sub) in my vb.net app to vba in
word?

Thanks

Regards

Nov 20 '05 #4
"John" <jo**@nospam.infovis.co.uk> schrieb
Hi

How do I save the vb.net app as activex dll? Is activex dll supported
in .net apps?


See Herfried's link. See also the Framework documentation:
http://msdn.microsoft.com/library/en...nentstocom.asp

See also the VB.NET documentation:
http://msdn.microsoft.com/library/en...perability.asp
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
Nov 20 '05 #5
Armin Zingler wrote:
See also the VB.NET documentation:

http://msdn.microsoft.com/library/en...perability.asp

I never did like the ComClass attribute. I prefer the absolute control
of ComVisible, ProgId, Guid and ClassInterfaceType in conjunction with
interfaces.

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 20 '05 #6

OK, I am slowly trying to get the hang of things. At the bottom is what I
have come with as something I can call from Word VBA. When I build it I get
two files one dll and other tlb. Can I just add these to references in Word
and start using or do I need to do something else before that?

Thanks

Regards

Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices

<Assembly: AssemblyKeyFile("C:\Events
Manager\Contacts\EventHelper\EventHelper\EventHelp er.snk")>

Namespace MyCompany.EventHelper

Public Interface IEventHelper
Event WordDocSaved(ByRef Doc As Object)
Event WordDocPrinted(ByRef Doc As Object)
Function Instance() As IEventHelper
Sub RaiseWordDocSaved(ByRef Doc As Object)
Sub RaiseWordDocPrinted(ByRef Doc As Object)
End Interface

<ClassInterface(ClassInterfaceType.None)> _
Public Class EventHelper
Implements IEventHelper
Public Event WordDocSaved(ByRef Doc As Object) Implements
IEventHelper.WordDocSaved
Public Event WordDocPrinted(ByRef Doc As Object) Implements
IEventHelper.WordDocPrinted
Private Shared _Instance As EventHelper

Public Function Instance() As IEventHelper Implements IEventHelper.Instance
If (_Instance Is Nothing) Then
SyncLock GetType(EventHelper)
If (_Instance Is Nothing) Then
_Instance = New EventHelper
End If
End SyncLock
End If
Return _Instance
End Function

Public Sub RaiseWordDocSaved(ByRef Doc As Object) Implements
IEventHelper.RaiseWordDocSaved
RaiseEvent WordDocSaved(Doc)
End Sub

Public Sub RaiseWordDocPrinted(ByRef Doc As Object) Implements
IEventHelper.RaiseWordDocPrinted
RaiseEvent WordDocPrinted(Doc)
End Sub

End Class
End Namespace
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:et**************@tk2msftngp13.phx.gbl...
* "John" <jo**@nospam.infovis.co.uk> scripsit:
How can I expose procedures (function or sub) in my vb.net app to vba in
word?
Please do not make excessive use of X-posts.

You can make classes and methods visible to COM and use the DLL within
your VBA application. You will find a sample for using a .NET DLL from
within VB6 here:

<http://www.mvps.org/dotnet/dotnet/sa...nloads/MyComLi
b.zip>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jeff | last post by:
I have question about differences in fenced sql procedures and fenced stored procedures. Do fenced sql procedures take up an extra memory segment when executed? Reason I ask is we have several...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
4
by: Peter Hemmingsen | last post by:
Hi, I have a dotnet object (implemented in mc++ and used in c#) which have a property called "Info". The Info property is also a dotnet object (implemented in mc++). In the constructor of the...
8
by: Dave A | last post by:
I have a class called 'PrimaryKey' that represents the primary key of a table. PrimaryKeys can only be created and the class only implements .ToString(). The PrimaryKey class internally stores...
2
by: Neil Cerutti | last post by:
I'm using doctest for the first time, and boy is it cool. But I'm nervous about exposing library internals in the docstring. def glk_cancel_char_event(win): """ Cancel a pending request for...
4
by: =?Utf-8?B?QkogU2FmZGll?= | last post by:
We have a class that has a public property that is of type List<T>. FXCop generates a DoNotExposeGenericLists error, indicating "System.Collections.Generic.List<Tis a generic collection designed...
4
by: =?Utf-8?B?Y2hyaXNjYXA=?= | last post by:
I tried searching the forums for this already and didn't find anything. I want to expose functionality from a vb6 COM component via a WCF service. I am trying to evaluate if exposing this...
1
by: bantunks | last post by:
Hello, I am trying to figure out the advantages and disadvantages of exposing interfaces through Opaque data types in C. I have figured/found out the following two advantages 1. Higher level of...
3
by: John | last post by:
Hi. I have a number of batch jobs that are ran nightly on our Windows 2000 based Oracle 8.1.7 (soon to be 9i) server. I have these designed just right, so the Windows Scheduled Tasks runs them...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.