Specifying Object Library References at Runtime

C

Cory

I have written a rather lengthy set of subs under a publisher document that
(since I have opened them on Pub 2003) are now associated with the 2003
Object Model. The 2002/xp object model for publisher is for the most part
the same, a few small differences.

Other people in my office want to use this tool, and are unable to because
when it tries to run it can't compile since it can't find the Publisher 11.0
object library. Since I have already written the subs and procedures outand
designed a number of userforms, I would rather not have to mess with it too
much. As I understand there is a way to mess with the VBIDE References
(worked well in Access) so that
If Application.Version = "10.0" Then
Application.VBIDE.CurrentVBProject.References.AddFromFile "Filename.dll"
End If

can be specified to reference a specific library. I have tried using
similar statements in Publisher, but it does not seem to be working out well.
Can anyone give me a hand figuring out where the reference objects lie in
publishers version of the VBIDE? The code examples given in the help files
are non-worky.

Really I just need to check version at run-time (possibly through the
Document_Open event) and reference the appropriate library. Also, It wont
let me disassociate the 11.0 library already associated with it, so if there
is a way to FORCE it to remove it, that would be helpful as well.

Any help will be appreciated.

Cory
 
E

Ed Bennett

Cory said:
The 2002/xp object model for publisher is for the most part
the same, a few small differences.

I'd have to disagree with you there. Superficially they look the same,
but as soon as you try and do anything, you realise that Publisher
2002's OM is far less complete than 2003's.
can be specified to reference a specific library. I have tried using
similar statements in Publisher, but it does not seem to be working out well.
Can anyone give me a hand figuring out where the reference objects lie in
publishers version of the VBIDE? The code examples given in the help files
are non-worky.

Do you have a help query that returns the non-worky code examples?
 
C

Cory

Certainly! The following is under the help topic for the IsBroken property
entry in the help.

Debug.Print Application.VBE.vbprojects(1).References(1).IsBroken

When executed returns an error saying method or data member not found. In
Excel I used a similar statement, and it worked. I looked at the Application
object in the watch window and saw VBE (I think, Can't recall right off
hand, working on a different unconnected network right now) as an object
under Application. Publsihers Application object does not seem to have this
object under it. There has to be a way to access the References collection.
Just don't know how.

Cory
 

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