Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Use Macro to insert picture without specifying height and width

Posted on 2007-11-29
6
Medium Priority
?
789 Views
Last Modified: 2012-06-21
I wish to create a macro to automatically enter jpegs into a Powerpoint presentation. Every month I will have a different set of about 300 jpegs named 1.jpg, 2.jpg, 3.jpg etc. (named in incriments of 1) to enter in a presentation.  I have already sized the pics to fit in the powerpoint window However I find if I record a macro to enter the  jpegs, it automatically puts in the dimensions of the pic, and if I later try to reuse this macro with a different picture of the same name the dimensions will be different and this will distort the pic inserted. The code is attached - I really want to leave out the dimensions (width and height) and have Powerpoint accept the pic as is - Is this possible and if so how?
ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="C:\Data\Photos\Auctions\B2127\Pres\8.jpg", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=160, Top:=1, Width:=400, Height:=538).Select

Open in new window

0
Comment
Question by:mgthegarty
  • 2
  • 2
6 Comments
 
LVL 21

Expert Comment

by:GlennaShaw
ID: 20377847
See this:
Batch Insert a folder full of pictures, one per slide
http://pptfaq.com/FAQ00352.htm

Especially:
    ' Reset it to its "real" size
    With oPic
        .Scaleheight 1, msoTrue
        .Scalewidth 1, msoTrue
    End With
0
 

Author Comment

by:mgthegarty
ID: 20381000
Hi GlennaShaw,
Thanks for the tip, I found it very helpful, but my pics are numbered 1.jpg, 2.jpg, 3.jpg, 4.jpg and so on and each slide is numbered on top left with the corresponding numbered jpeg inserted.  My problem is that the pics are entered in alphabetical order, i.e. 1, 10, 11, 12 etc, and not as they are sorted in numerical order in say an explorer window.  Can I change the order in which the pics are insterted and if so how?
0
 

Author Comment

by:mgthegarty
ID: 20381107
Hi GlennaShaw,
I hope my previous comment made sense, When inserting the photos from the folder Powerpoint seems to sort them as sorts are done on the web (eg. 1,10,100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 11, 110, 111 and so on.... ).  What happens therefore is that photo 1.jpg is inserted correctly into slide number 1, but photo 10 is inserted into slide 2, photo 100 is inserted to slide 3 and so on).  Can the order of insert be changed to numerical and if so, how?  Thanks
0
 
LVL 21

Accepted Solution

by:
GlennaShaw earned 2000 total points
ID: 20381798
I have a simple question, why aren't you doing this with Photo Album?  It would be much, much easier.
See:
http://office.microsoft.com/en-us/powerpoint/HA011593111033.aspx?pid=CH010017291033 and
http://office.microsoft.com/en-us/powerpoint/HA010348201033.aspx

Other options:
http://pptfaq.com/FAQ00050.htm

0
 
LVL 1

Expert Comment

by:Computer101
ID: 20658383
Forced accept.

Computer101
EE Admin
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
This video teaches viewers how to fit pictures into slides, crop and remove backgrounds, and alter photos to look more professional.
This video teaches viewers how to create handouts from their slides and helps them decide how many slides to include per handout.

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question