Experience with Ms Project and Access?

MsAccessNL

Member
Local time
Today, 05:30
Joined
Aug 27, 2022
Messages
209
I saw a post that ms project is also vba compatible. I am surpised, I never heard anything about project and vba. Does anybody have experience and is this not a great combination with ms access?
 
I think you can run almost anything you want in VBA. It's a matter of going to the IDE (Alt+F11) then referencing said namespace/ DLL (Dynamic Link Library), you then have access to it's procedures... You are then behest to the documentation/ info available to that namespace/ DLL (application).
Check it out, you'll see pretty much every application in there.
 
A long time ago, around 2011 or 2012, we did some work that involved both Project and Access. I can't remember doing much automation with Project, though.
 
MS Learn claims you can do some COM programming via VBA apps.

 
project.jpg
 
I think you can run almost anything you want in VBA.
[...]
Check it out, you'll see pretty much every application in there.
You're only going to see registered COM/ActiveX object libraries there. So, it depends on whether the creator of the application did created and published such a library. Most application developers don't. Microsoft was a notable exception the past and provided such libraries for many (not all!) of their applications. In recent years COM has fallen out of favor at Microsoft because it is limited to Windows Desktop operations systems and thus is unsuitable for their current strategy of prioritizing the web and mobile.
We see the unpleasant consequences with some very relevant new components and applications, such as the New Outlook and the WebView2 browser component, which do not have corresponding COM/ActiveX object libraries.
 
Does anybody have experience and is this not a great combination with ms access?
I'm not so sure about that.
I did some very limited VBA work in MsProject many years ago.
More recently, but still years ago, I put together a proposal for a client to synchronize Data in an Access DB with project plans maintained in MsProject. - The client didn't like the proposal, or rather its price tag, because they massively underestimated the complexity of keeping multiple different local file based data stores in sync, which all can also be edited independently.
 
There is absolutely no issue. I have worked with Project and Excel and Project and Access. No different then working with Access and Excel or Access and Word or Access and Outlook or Access and Power Point. Automation is automation. Only potential issue is that the Project object model is pretty challenging, but that is just because understanding Project can be challenging once you start getting into fully resourced planning. At the time I was doing it there was not as much available information compared to Excel and Access. I imagine know with Chat and other internet resources should be easy.
 
I did a bit of work in MS Project a couple of years ago, and my impression was it was wide open for integration. It exposes tons of open text and numeric fields you can push data into. I thought the object model was superficially simple, with Tasks and Resources as the two main info silos, and these are joined by Assignments in a many-to-many relationship, so each Assignment has a single Task and a single Resource as a parent. Simple.
• But it's not that simple, because if you retrieve an Assignment as a child of Task and push in data, and then retrieve that same Assignment as a child of a Resource, the data you pushed in is not present.
• User data exposed by an Assignment is dependent on which parent you retrieve it from, which is not immediately obvious.
• So if you are working with TaskA, the data exposed by its child AssignmentB is Task-related. If you need access to AssignmentB's Resource-related data, you need to...
1) retrieve AssignmentB's parent ResourceC
2) enumerate each Assignment in ResourceC.Assignments
4) retrieve the one where TaskID = TaskA.TaskID
This gives you access to AssignmentB's resource-related data.
 
There is absolutely no issue. I have worked with Project and Excel and Project and Access. No different then working with Access and Excel or Access and Word or Access and Outlook or Access and Power Point. Automation is automation. Only potential issue is that the Project object model is pretty challenging, but that is just because understanding Project can be challenging once you start getting into fully resourced planning. At the time I was doing it there was not as much available information compared to Excel and Access. I imagine know with Chat and other internet resources should be easy.

Concur with MajP - Early on in my association with the U.S. Navy we had a couple of MS Project uses where I helped. The details are a bit sketchy because this was 30+ years ago and I haven't touched Project since then, but it was a bear to try to fit the Navy's projects into the object model of MS Project. It still was useful, but I remember it as high-maintenance in the presence of a fluid project.
 
When I start developing in a VBA-enabled application, the first thing I do is check whether it includes a macro recorder. If it does, I use it to see what code gets generated for typical actions, and then adapt that code to fit my needs.

If there's no macro recorder, or if I need to go beyond what it captures, I start by adding some basic elements manually and observing how the application object handles them. Inspecting the application's object model through the Watch window is especially useful for that kind of discovery.

Once you've interacted with the app manually as intended, it's just a matter of expanding nodes in the application object tree (from the Watch window, the debugger) to see where things are defined. When I spot relevant properties, I play around with them to understand how they behave. After that, I look into the available methods to see what functionality I can tap into.

This process is pretty consistent across Microsoft Office products. However, some applications may require approaches that feel unfamiliar, especially if you're coming from an Access background. In those cases, there's usually a bit of learning involved. For example, some methods may expect arrays as parameters, like in AutoCAD (not a Microsoft product, but also VBA-based).

Other methods might require you to define a variable first, because that variable is expected to receive something. In some cases, you'll need to create and configure one or more objects beforehand just to use a method at all.

Once you have a working piece of code from within the application, you can automate it from another VBA-enabled program using pretty much the same code, simply by swapping the local application object with the external one, using either early or late binding depending on what suits the project.
 

Users who are viewing this thread

Back
Top Bottom