Script advice required :-)

M

MarkI

Can anyone tell me the best way to do this please via vb:

I want to print some images onto some pre-printed stationary so ideally i'd
like to:

Prompt for a directory on the user's machine
for every file (image) in the chosen directory
get the image size it and place it into a picture frame of a standard size
in the same position
print the page (no saving)
get the next image

I'm ok with vb in other applications, but know nothing about publisher
objects methods and properties. Anyone got any sample code to get me
started?

Many thanks.

Oh yes, I have 3 days to sort this :-(
 
E

Ed Bennett

MarkI said:
I'm ok with vb in other applications, but know nothing about publisher
objects methods and properties. Anyone got any sample code to get me
started?

Try:
c:\Program Files\Microsoft Office\Office11\1033\VBAPB10.CHM
This is the object model documentation for Publisher. Tells you almost
everything about the object model (apart from the couple of undocumented
features, which are obvious if you use the Object Browser)

http://msdn.microsoft.com/office/understanding/publisher/default.aspx
This is the Publisher Developer Center. Check out the Technical Articles -
plenty of sample code (although much of it is aimed at new developers, not
experienced developers who are new to Publisher.
Oh yes, I have 3 days to sort this :-(

If you don't think you can handle it in time, give me an email and we might
be able to arrange something.
My reply address is valid.
 
M

Mark I

If you don't think you can handle it in time, give me an email and we
might be able to arrange something.
My reply address is valid.

many thanks for the sources. I have actually got a lot further than I
thought :) I have virtually the whole thing working. A couple of questions
if I may...

I am trying to quit the application after all images have been printed, but
I get an error message saying that code is running in the active document.
The code that is running, is the one to close the application! How can I get
around this?

Secondly, it would be great if I could run the whole thing in the background
without the application showing on the user's screen (as pictures keep
flashing up and disappearing). Is there a way to set the visibility?

Other than that, I'm pretty much done.

Thanks again for the info - it was most useful.

Mark
 
E

Ed Bennett

Mark I said:
I am trying to quit the application after all images have been
printed, but I get an error message saying that code is running in
the active document. The code that is running, is the one to close
the application! How can I get around this?

If you run code from within Publisher, you're not allowed to quit the
current application.
If you code an add-in, or an application that automates Publisher, in a
program such as Visual Basic, then you are able to do this.
Secondly, it would be great if I could run the whole thing in the
background without the application showing on the user's screen (as
pictures keep flashing up and disappearing). Is there a way to set
the visibility?

Take a look at ActiveWindow.Visible.
 
M

Mark I

Ed Bennett said:
If you run code from within Publisher, you're not allowed to quit the
current application.
If you code an add-in, or an application that automates Publisher, in a
program such as Visual Basic, then you are able to do this.


Take a look at ActiveWindow.Visible.
Thanks again Ed - I am now sorted and quite taken with programming in
publisher!

Cheers

Mark
 

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