> I'm used to Visual Studio 2005, and I've been trying to create a solution in
> Publisher using VBA. The differences are frustrating me...
Why not write your solution in VS05?
> I have everything working--EXCEPT closing the documents I opened, and the
> modal user form I'm using as a UI, so I can close the original publisher app.
> Any ideas? Am I making sense?
I don't think you're allowed to close the instance of Publisher from
which the form was called, but I think any other instances you've
instantiated can be closed. Writing an application that automates
Publisher from the outside rather than a VBA script inside Publisher
will allow this.

Signature
Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org
J Holtendehouzer - 19 May 2007 02:57 GMT
Thanks for your reply, Ed. I had the understanding that VS05 with VSTO
doesn't support automating Publisher. Is that incorrect?
I would LOVE to write it in VS05--it's a much more familiar environment for
me. However, I haven't been able to make it work.
Can you point me to a remedial explanation of how to do what I need to do?
(I'm kind of an idiot!)
Thanks in advance,
Joe
> > I'm used to Visual Studio 2005, and I've been trying to create a solution in
> > Publisher using VBA. The differences are frustrating me...
[quoted text clipped - 10 lines]
> Publisher from the outside rather than a VBA script inside Publisher
> will allow this.
Ed Bennett - 19 May 2007 11:30 GMT
> Thanks for your reply, Ed. I had the understanding that VS05 with VSTO
> doesn't support automating Publisher. Is that incorrect?
VSTO doesn't support Publisher, but that doesn't stop you from simply
automating Publisher through its COM interface (the same way VBA works,
I think, and the same as writing an add-in).
I'm not aware of any guides for automating Publisher, but it's pretty
simple. Add references to the Publisher Object Library and the Office
Object Library (you MUST have the PIAs for Office installed before doing
this - check your GAC or run through a custom Office Setup and make sure
they're checked - look for '.Net Programmability Support'), and then
create a new instance of Publisher with:
VB:
Dim pbApp As New Microsoft.Office.Interop.Publisher.Application
C# (probably):
Microsoft.Office.Interop.Publisher.Application pbApp = new
Microsoft.Office.Interop.Publisher.Application();
Then declare a Publisher.Document and use the pbApp.Open method to give
it a document. Etc.

Signature
Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org
J Holtendehouzer - 19 May 2007 15:14 GMT
Ed, you're awesome. Thanks!
> > Thanks for your reply, Ed. I had the understanding that VS05 with VSTO
> > doesn't support automating Publisher. Is that incorrect?
[quoted text clipped - 19 lines]
> Then declare a Publisher.Document and use the pbApp.Open method to give
> it a document. Etc.