473,386 Members | 1,679 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,386 software developers and data experts.

Calling back vb.net app

Hi

I am opening word from my vb.net app. Is there a way to call a procedure in
the vb.net app from a word macro?

Thanks

Regards

Nov 20 '05 #1
7 1539
why are you posting this to the whole world?

anyway, I would suggest converting the code in the macro to something
useable in vb.net and placing it there thus eliminating the problem.

I can't help anymore without more details.

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

I am opening word from my vb.net app. Is there a way to call a procedure in the vb.net app from a word macro?

Thanks

Regards

Nov 20 '05 #2
What I need is that when word does something, it informs the calling vb.net
app. Therefore I need word to be able to communicate with the vb.net app.

Thanks

Regards
"scorpion53061" <sc****************************@yahoo.com> wrote in message
news:ew**************@TK2MSFTNGP11.phx.gbl...
why are you posting this to the whole world?

anyway, I would suggest converting the code in the macro to something
useable in vb.net and placing it there thus eliminating the problem.

I can't help anymore without more details.

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

I am opening word from my vb.net app. Is there a way to call a procedure

in
the vb.net app from a word macro?

Thanks

Regards


Nov 20 '05 #3

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
What I need is that when word does something, it informs the calling vb.net app. Therefore I need word to be able to communicate with the vb.net app.


It depends rather on what that something is and the circumstances in which
the VB.NET app is listening.

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

Nov 20 '05 #4

My example is given at the bottom. I need to call it 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

"Jonathan West" <jw***@mvps.org> wrote in message
news:O0****************@TK2MSFTNGP12.phx.gbl...

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:Ob**************@TK2MSFTNGP10.phx.gbl...
What I need is that when word does something, it informs the calling vb.net
app. Therefore I need word to be able to communicate with the vb.net

app.
It depends rather on what that something is and the circumstances in which
the VB.NET app is listening.

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

Nov 20 '05 #5

"John" <jo**@nospam.infovis.co.uk> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

My example is given at the bottom. I need to call it 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?


That depends on whether the DLL implements a COM interface. If the DLL has a
COM interface, then you will be able to set a reference to it by going to
the Word VBA editor, selecting Tools, References, and then setting a
reference to your DLL.

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

Nov 20 '05 #6
On Thu, 25 Dec 2003 21:45:24 -0000, "John" <jo**@nospam.infovis.co.uk> wrote:

¤ Hi
¤
¤ I am opening word from my vb.net app. Is there a way to call a procedure in
¤ the vb.net app from a word macro?
¤

Using Events would be the best method. You really don't want to have the client and automation
server calling each other:

See if the following helps:

HOWTO: Handle Events for Microsoft Word Using Microsoft Visual Basic .NET
http://support.microsoft.com/default...&Product=vbNET
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 20 '05 #7
Hi John,
Yes, I agree. This is what I started with but Word odes not expose
DocumentAfterSave and DocumentAfterPrint which are the two events which I am
after. Anyway my vb.net app can know when the document has been saved and/or
printed?

If you intercept the "Before" events, then send the Save resp. PrintOut
commands in your code, the code will wait until the actions have been
processed, then proceed. You just have to make sure you set the Background
printing option to FALSE.

-- Cindy

Nov 20 '05 #8

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

Similar topics

1
by: Lauren Quantrell | last post by:
I'm using an Access2K front end on a SQL Server2K backend. I use Scope_Identity() in a lot of stored procedures to pass the newwly inserted record's unique ID to the next select statement in the...
7
by: Klaus Friese | last post by:
Hi, i'm currently working on a plugin for Adobe InDesign and i have some problems with that. I'm not really a c++ guru, maybe somebody here has an idea how to solve this. The plugin is...
30
by: Tim Marshall | last post by:
Here's the scenario, A2003, Jet back end, illustrated with some cut down code at the end of the post: A proc dims a snapshot recordset (dim rst as Dao.recordset) and opens it. There are several...
4
by: Peter Afonin | last post by:
Hello, I have a weirdest issue I've ever had. I have a function that enters some data into the Oracle table and returns the sequential row number for the new record (autonumber): Private...
0
by: jobs | last post by:
I have a page where users select from a bunch of gridviews, setting session variables and then hit an a New or Edit button which redirects them to a formview in edit or insert mode. While in...
2
by: sumanthsclsdc | last post by:
Hello friends, I have a problem, I implemented a class which uses tkinter and displays the window as required, the class will create a window with listbox and inserts some items into it, I...
2
by: eholz1 | last post by:
Hello PHP Group, I have a php page that calls another php page to load a image from a database (mysql) in to the calling page. It works like this: first_view.php has <img src="image.php?img=5"...
4
by: dave m | last post by:
I'm creating a class library (dll) and am confused as how to pass any information, should any exceptions occur, back to the calling application. Such as: Try x = 3 / 0 ' divide by 0 error...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.