Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Publisher / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Macro in publisher

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stella - 08 Feb 2007 07:23 GMT
I am trying to find out how to insert a picture from a file into a macro. I
cannt find much in the help bar nor in literature nor in the five lessons on
how to write macros. So I am lost. I need to write a simple macro that insert
a picture from file (or fills an empty picture frame). How can I do this?
Ed Bennett - 08 Feb 2007 15:30 GMT
> I am trying to find out how to insert a picture from a file into a macro. I
> cannt find much in the help bar nor in literature nor in the five lessons on
> how to write macros. So I am lost. I need to write a simple macro that insert
> a picture from file (or fills an empty picture frame). How can I do this?

(Page Object).Shapes.AddPicture?

Signature

Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org

Stella - 09 Feb 2007 02:34 GMT
I tried two hours on this today but do get errors

Sub first()
Dim page As page
Set page.Shapes.AddPicture"E:\picture1.jpg"

what is wrong with giving the path to the picture?
Thanks

> > I am trying to find out how to insert a picture from a file into a macro. I
> > cannt find much in the help bar nor in literature nor in the five lessons on
> > how to write macros. So I am lost. I need to write a simple macro that insert
> > a picture from file (or fills an empty picture frame). How can I do this?
>
> (Page Object).Shapes.AddPicture?
Ed Bennett - 09 Feb 2007 08:28 GMT
> I tried two hours on this today but do get errors
>
[quoted text clipped - 3 lines]
>
> what is wrong with giving the path to the picture?

a) "page" is the name of the Page data type, and so is reserved and
cannot be used for a variable name.

b) You haven't ended your sub.

c) "Set" is used to assign an object to a variable. For example, if your
Page variable were called "aPage", then

    Set aPage = ThisDocument.Pages(1)

would set aPage to be the first page of the current document, and

    Set aPage = ThisDocument.ActiveView.ActivePage

would set aPage to be the active page.

d) "Set" is not used for executing methods. The AddPicture method is a
method, and so goes on a line of its own; unless you want to assign the
resulting shape to a new variable. For example

    aPage.Shapes.AddPicture "e:\Picture1.jpg"

or

    Dim aShape As Shape
    Set aShape = aPage.Shapes.AddPicture("e:\Picture1.jpg")

(note that when the method comes after an assignment, the arguments are
bracketed; otherwise, they are not)

Signature

Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.