Help with Outlook function

D

Doug Lowe

Hi everyone,

I've written a VBA macro that runs in Word to help users create form letters
with names drawn from an Exchange contacts folder via the Outlook object
model. It populates a drop-down list with all of the names from the folder.
Because this takes about 30 seconds, and the list of contacts doesn't change
that often, I opted to read the names from a cached text file saved on a
network store. The dialog box has a button the user can click that creates a
new version of this cache file when necessary.

The problem is that I'd like to schedule this update to run on a nightly
basis. What would be the best way to do this, if possible without porting
the Word VBA code that accesses the Outlook objects to some other platform.
I think the easiest would be to it up to run nightly on a client computer
that has Word and Outlook installed. To do that I think I'd just have to
create a macro that calls the Sub that updates the cache file, then schedule
WinWord with the right switches to run the macro.

But I think the users would rather have this run on a server computer
instead of a client, which might get turned off at night. But it seems to me
that unless I install Word & Outlook on the server, I'll have to port the
code to some other platform. If so, what would be the best? They don't have
..NET on the servers (they're Win2K), but said they could put it there. But
is access to an Exchange contacts folder easy to do through .NET? Or what
about Java -- is there a library I could use?

I'd appreciate any advice. Thanks!

--Doug
 
M

Malcolm Smith

Doug

I did this once. What I had on the client machine was a collection I made
myself of Contacts in my own class library. The code for this was in
one of the start-up templates.

The first time I asked for a contact information then the 30 second build
of the collection would happen. Then throughout the rest of the day then
collection would remain in memory and everyone was happy.

Mind you, this was in a legal environment where the users would open Word
first thing in the morning and stay in there until they went home in the
evening.

- Malc
 
P

Pete Bennett

Actually, what you could do is do the same as Malcom has done, except copy
the resulting text file onto a shared network folder.

Then, as part of the autoexec code, check that network folder. If the date
of the file there isn't today, create a new text file using the slow method.

That means that the first person who goes into Word each day has to suffer
the 30 sec delay, but from then on, the rest of the firm/department is
working in fast mode.

You just have to make sure that other users don't access the text file for
the duration that it's being created (which is easy enough as you can open it
with exclusive rights).
 

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