DTS Packages to run Macro

G

Guest

Does anyone know if its possible for a DTS package to run an Outlook Macro?
I have created a Macro to take a main public folder, and move the messages to
subfolders based on the subject line. I set the code up so it will always
find the folders needed, and if not, just not use them, so I know the process
won't turn zombied (sorry, I use Linux a lot, I don't know the correct term
for this). I try to set it up just like an Excel Macro to run through DTS,
only createobject(Outlook.Application). But heres the part that the DTS does
not like:

macroname = "Seperate"
SET ol_app = CREATEOBJECT("OutLook.Application")
HERE---> ol_app.Run macroname <-----------HERE

Any ideas? Thanks in advanced for your help.
 
S

Sue Mosher [MVP-Outlook]

The macro would need to be a Public sub in the ThisOutlookSession module and then can be run as ol_app.Separate. Note that this technique is unsupported and may not work in all coding environments. A script might be more appropriate.
 
G

Guest

I have a new way of running the Macro. I cannot use scripts because Outlook
will not support them on a Thin Client for Public Folders.

I am now running it in Excel and Refercing Outlook. This works great in the
DTS package and the Macro itself, but it has issues with the Service Account.
The Service Account has no mapped drives, so I ahve to give direct paths.
It does have outlook. But it freezes in the SQL Query Analyzer everytime at
the declaration of:
Dim MainFolder As Outlook.MAPIFolder
It does not like the fact that I call Outlook.MAPIFolder. Do I need a full
path connections? If so, what is it?
Thanks again in advanced for your help.
 
S

Sue Mosher [MVP-Outlook]

Did you add a reference to the Outlook library to your project?

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Lee said:
I have a new way of running the Macro. I cannot use scripts because Outlook
will not support them on a Thin Client for Public Folders.

I am now running it in Excel and Refercing Outlook. This works great in the
DTS package and the Macro itself, but it has issues with the Service Account.
The Service Account has no mapped drives, so I ahve to give direct paths.
It does have outlook. But it freezes in the SQL Query Analyzer everytime at
the declaration of:
Dim MainFolder As Outlook.MAPIFolder
It does not like the fact that I call Outlook.MAPIFolder. Do I need a full
path connections? If so, what is it?
Thanks again in advanced for your help.
 
G

Guest

Yes, I added the reference to Microsoft Outlook 10.0 Object Library. Do you
think it is because its not me opening the file, but a different account?
How do I make sure the reference stays when another user opens it? Is there
any way in the macro to say "Open Tools->Reference and check the Microsoft
Outlook 10.0 Object Library?"
Thanks again for your help.
 
S

Sue Mosher [MVP-Outlook]

It finally dawned on me that you're trying to automate Outlook from a server application. That's simply a non-starter and not just because you probably don't have Outlook installed on your SQL server (which is probably why you're getting the declaration error). There are a variety of reasons and a long KB article about it.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Lee said:
Yes, I added the reference to Microsoft Outlook 10.0 Object Library. Do you
think it is because its not me opening the file, but a different account?
How do I make sure the reference stays when another user opens it? Is there
any way in the macro to say "Open Tools->Reference and check the Microsoft
Outlook 10.0 Object Library?"
Thanks again for your help.
 
G

Guest

Thanks again Sue, you were right. I guess since I bought the book, I should
read it and understand it instead of just looking for things I need to
program.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top