A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Is it possible tse my VB procedure in Form VBS script ?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 2nd 08, 10:13 AM posted to microsoft.public.outlook.program_forms
Bert_Bert[_2_]
external usenet poster
 
Posts: 32
Default Is it possible tse my VB procedure in Form VBS script ?

I have DLL addin in VB6 that has already ready function for special filtering
based on text SWL query, e.g.
[Categories]='mycateg' AND [MyFiled]='myvalue' AND [anotheruserfield]0

Since the txt SQL query is specified onf customized form, I would like to
return number of returned records and I do not want to repeat program - I use
Redemption to perform filtering and in Form VBS it would be too longd and
badly maintained.

Do I have some possibility to
1. check whether my DLL is registered and initialized
2. call somehow my function to find number of records mathing my custom SQL
and show it on my form ?
3. or, if not possible, perhaps some Event that would be invoked by the DLL
addin and pushed the value to the open form?

tahk you
Ads
  #2  
Old September 2nd 08, 02:35 PM posted to microsoft.public.outlook.program_forms
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Is it possible tse my VB procedure in Form VBS script ?

If your DLL is an Outlook COM addin you can use the
Application.COMAddIns.Item("myAddin").Connect Boolean property to see if
your addin is there and connected. You could check for registration using
calls to the registry to see if the dll is registered. If an addin you could
also check the LoadBehavior value to see if the addin was set to connect on
startup or on demand.

You can certainly connect to your addin from the outside world (a form) and
call a method in your addin if that method is exposed. For a VB6 addin it's
as simple as setting AddInInst.Object = Me in your OnConnection() handler
and having a public Sub or Function in that connect class. That can then
have the complete code or proxy to a Sub or Function somewhere else in your
addin code.

On the calling side you'd use code like this:

Dim oAddinBase 'as Object
Set oAddinBase = Application.COMAddIns.Item("myAddin").Object

From there you can use the oAddinBase object to call your public Subs or
Functions. For example, you have a Function named Foobar that returns a
Boolean:

Dim blnResult
blnResult = oAddinBase.Foobar()

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Bert_Bert" wrote in message
...
I have DLL addin in VB6 that has already ready function for special
filtering
based on text SWL query, e.g.
[Categories]='mycateg' AND [MyFiled]='myvalue' AND [anotheruserfield]0

Since the txt SQL query is specified onf customized form, I would like to
return number of returned records and I do not want to repeat program - I
use
Redemption to perform filtering and in Form VBS it would be too longd and
badly maintained.

Do I have some possibility to
1. check whether my DLL is registered and initialized
2. call somehow my function to find number of records mathing my custom
SQL
and show it on my form ?
3. or, if not possible, perhaps some Event that would be invoked by the
DLL
addin and pushed the value to the open form?

tahk you


  #3  
Old September 5th 08, 11:04 PM posted to microsoft.public.outlook.program_forms
Bert_Bert[_2_]
external usenet poster
 
Posts: 32
Default Is it possible tse my VB procedure in Form VBS script ?

Wonderful ! I did not hope that it could work so easy.
Just had to google a detail and correct:
Set oAddinBase = Application.COMAddIns.Item("myAddin").Object
Set oAddinBase = Application.COMAddIns.Item("myAddin.Connect").Obje ct

and after while (well, while before computer always means several hours )
it works. What I could not understand was why I saw as a name
"Microsoft.VbaAddinForOutlook" and tried to find out how to change ProgID of
my DLL manually and was a bit confused what precisely REGSVR32 does tu put
the object in the registry.

But as far as I did
Set oAddinBase = Application.COMAddIns.Item("myAddin.Connect").Obje ct
I could find the addin according to my name in VBScript.

Thank you for a good tip Ken !



If your DLL is an Outlook COM addin you can use the
Application.COMAddIns.Item("myAddin").Connect Boolean property to see if
your addin is there and connected. You could check for registration using
calls to the registry to see if the dll is registered. If an addin you could
also check the LoadBehavior value to see if the addin was set to connect on
startup or on demand.

You can certainly connect to your addin from the outside world (a form) and
call a method in your addin if that method is exposed. For a VB6 addin it's
as simple as setting AddInInst.Object = Me in your OnConnection() handler
and having a public Sub or Function in that connect class. That can then
have the complete code or proxy to a Sub or Function somewhere else in your
addin code.

On the calling side you'd use code like this:

Dim oAddinBase 'as Object
Set oAddinBase = Application.COMAddIns.Item("myAddin").Object

From there you can use the oAddinBase object to call your public Subs or
Functions. For example, you have a Function named Foobar that returns a
Boolean:

Dim blnResult
blnResult = oAddinBase.Foobar()

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Bert_Bert" wrote in message
...
I have DLL addin in VB6 that has already ready function for special
filtering
based on text SWL query, e.g.
[Categories]='mycateg' AND [MyFiled]='myvalue' AND [anotheruserfield]0

Since the txt SQL query is specified onf customized form, I would like to
return number of returned records and I do not want to repeat program - I
use
Redemption to perform filtering and in Form VBS it would be too longd and
badly maintained.

Do I have some possibility to
1. check whether my DLL is registered and initialized
2. call somehow my function to find number of records mathing my custom
SQL
and show it on my form ?
3. or, if not possible, perhaps some Event that would be invoked by the
DLL
addin and pushed the value to the open form?

tahk you



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
script of custom form for shared calender doesn't run sd[_2_] Add-ins for Outlook 3 April 4th 08 01:07 PM
Outlook Form Script: How to get the Focus bbnimda Outlook and VBA 1 November 23rd 07 03:04 PM
Getting user input using a form and returning to procedure Twotone Outlook and VBA 2 February 7th 07 09:46 PM
Script Error in Custom Form Bryan Dickerson Outlook - Using Forms 5 April 18th 06 05:46 PM
How do I call a stored procedure inside my sql with a vba script? Computer Newbie Outlook and VBA 1 March 14th 06 07:08 AM


All times are GMT +1. The time now is 06:15 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.