Prevent "Import Wizard" from appearing with automation

E

E. Froma

Hi,

I'm writing a programme in Visual Basic to update our 'Project 2003
Standard' masterplanning with our ERP database. The code lets MSProject save
itself as a .mdb database (Access), after which tasks are added (new tasks
found in the ERP are added automatically) and the task status of residing
tasks is updated (determined by the amount of hours booked on the tasks in
ERP). All of the updating and adding is done to the saved .mdb database with
sql.
Except for updating the planning the code also fills another custom database
which is used for a shop floor control system. This system (among other data)
needs the timephased data that is calulated by MSProject in de
msp_timephased_data table. (I know that I can also fill this table with SQL
but I'd rather let MSProject calculate it for me. That's what MSProject's
for...) So in the same run I need to modify the .mdb database, let MSProject
calculate the the newly added tasks and let it save the results to the same
..mdb database after which the timephased data can be extracted.

Now the problem:
When I let MSProject open the .mdb database halfway through the code the
code hangs because MSProject displays the "Import Wizard - Project
Definition" dialogue box. Here's a code snipplet that lets MSProject open the
..mdb:

Set PJ = GetObject(, "MSProject.Application")
PJ.FileOpen, Name:=FileLoc.PJmdb, ReadOnly:=False, FormatID:="MSProject.MDB8"

I've looked at the "Map" parameter for the method above but I want to all of
the .mdb to be imported and calculated. As far as I know one can only create
a "Map" in MSProject when one only wants to import specific tables/fields.

How can I prevent this annoying dialogue box from appearing?

As far as I can see my only option is to use windows API functions to
address this window, functions like Sendmessage or Postmessage? I've tried
the VBA Sendkeys method but this also doesn't work.

Is there a more simple way to avoid the dialogue box from appearing?

Thanks in advance,

E. Froma.
 

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