Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

import/export

13 views
Skip to first unread message

mcnewsxp

unread,
Nov 23, 2009, 10:57:03 AM11/23/09
to
i have to import some images to an existing PPT then export them so
thet the background image is retained, then import them into another
PPT for distribution. this is so the background branding is retained.
so 2 questions:
1) is there an easy smart way to do this\
2) or is there an way to export the saved images to the 2nd PPT via
VBA (i'm using VBA for the import/export).

tia,
mcnewsxp

Michael Koerner

unread,
Nov 23, 2009, 12:48:17 PM11/23/09
to
Once you have the images inserted into your presentation, save the
presentation as .png files which will save all your images with the slide
background in tact, then use Shyam's image importer wizard to import you new
images into your new presentation. http://skp.mvps.org/iiw.htm

--
Michael Koerner
MS MVP - PowerPoint


"mcnewsxp" <mcou...@mindspring.com> wrote in message
news:6d4a3997-bd57-40ce...@j9g2000vbp.googlegroups.com...

mcnewsxp

unread,
Nov 23, 2009, 2:03:48 PM11/23/09
to
On Nov 23, 12:48 pm, "Michael Koerner" <iam...@home.com> wrote:
> Once you have the images inserted into your presentation, save the
> presentation as .png files which will save all your images with the slide
> background in tact, then use Shyam's image importer wizard to import you new
> images into your new presentation.  http://skp.mvps.org/iiw.htm
>
> --
>   Michael Koerner
> MS MVP - PowerPoint
>
> "mcnewsxp" <mcour...@mindspring.com> wrote in message

>
> news:6d4a3997-bd57-40ce...@j9g2000vbp.googlegroups.com...
> i have to import some images to an existing PPT then export them so
> thet the background image is retained, then import them into another
> PPT for distribution.  this is so the background branding is retained.
> so 2 questions:
> 1) is there an easy smart way to do this\
> 2) or is there an way to export the saved images to the 2nd PPT via
> VBA (i'm using VBA for the import/export).
>
> tia,
> mcnewsxp

once confidured to do the import can it operate hands free?

Steve Rindsberg

unread,
Nov 23, 2009, 2:58:40 PM11/23/09
to
In article <6d4a3997-bd57-40ce-9d68-

98eced...@j9g2000vbp.googlegroups.com>, Mcnewsxp wrote:
> i have to import some images to an existing PPT then export them so
> thet the background image is retained, then import them into another
> PPT for distribution. this is so the background branding is retained.
> so 2 questions:
> 1) is there an easy smart way to do this\

Here's some code that will help with importing the images:

Batch Insert a folder full of pictures, one per slide
http://www.pptfaq.com/FAQ00352.htm

> 2) or is there an way to export the saved images to the 2nd PPT via
> VBA (i'm using VBA for the import/export).

Use the .Export method on each slide you want to export.

Export slides as graphics
http://www.pptfaq.com/FAQ00022.htm


==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


Michael Koerner

unread,
Nov 23, 2009, 3:41:02 PM11/23/09
to
It does that very well.

--
Michael Koerner
MS MVP - PowerPoint

"mcnewsxp" <mcou...@mindspring.com> wrote in message

news:aba0db1f-1c39-4076...@p36g2000vbn.googlegroups.com...

mcnewsxp

unread,
Nov 24, 2009, 8:17:47 AM11/24/09
to
On Nov 23, 2:58 pm, Steve Rindsberg <ab...@localhost.com> wrote:
> In article <6d4a3997-bd57-40ce-9d68-

>
> 98eced00d...@j9g2000vbp.googlegroups.com>, Mcnewsxp wrote:
> > i have to import some images to an existing PPT then export them so
> > thet the background image is retained, then import them into another
> > PPT for distribution.  this is so the background branding is retained.
> > so 2 questions:
> > 1) is there an easy smart way to do this\
>
> Here's some code that will help with importing the images:
>
> Batch Insert a folder full of pictures, one per slidehttp://www.pptfaq.com/FAQ00352.htm

>
> > 2) or is there an way to export the saved images to the 2nd PPT via
> > VBA (i'm using VBA for the import/export).
>
> Use the .Export method on each slide you want to export.
>
> Export slides as graphicshttp://www.pptfaq.com/FAQ00022.htm

>
> ==============================
> PPT Frequently Asked Questionshttp://www.pptfaq.com/
>
> PPTools add-ins for PowerPointhttp://www.pptools.com/

thanks for the code. what i have in my PPT is very similar. what i
need is a way to import the saved images into another PPT file, but
the import is control by VBA code from the original PPT file. the 2nd
PPT file will be distributed to multiple users and i do not want the
macro enable/disable dialog box to appear like it does when you have
VBA modules in your PPT file.

mcnewsxp

unread,
Nov 24, 2009, 9:10:00 AM11/24/09
to
On Nov 23, 3:41 pm, "Michael Koerner" <iam...@home.com> wrote:
> It does that very well.
>
> --
>   Michael Koerner
> MS MVP - PowerPoint
>
> "mcnewsxp" <mcour...@mindspring.com> wrote in message
>
> news:aba0db1f-1c39-4076...@p36g2000vbn.googlegroups.com...
> On Nov 23, 12:48 pm, "Michael Koerner" <iam...@home.com> wrote:
>
>
>
> > Once you have the images inserted into your presentation, save the
> > presentation as .png files which will save all your images with the slide
> > background in tact, then use Shyam's image importer wizard to import you
> > new
> > images into your new presentation.http://skp.mvps.org/iiw.htm

>
> > --
> > Michael Koerner
> > MS MVP - PowerPoint
>
> > "mcnewsxp" <mcour...@mindspring.com> wrote in message
>
> >news:6d4a3997-bd57-40ce...@j9g2000vbp.googlegroups.com...
> > i have to import some images to an existing PPT then export them so
> > thet the background image is retained, then import them into another
> > PPT for distribution. this is so the background branding is retained.
> > so 2 questions:
> > 1) is there an easy smart way to do this\
> > 2) or is there an way to export the saved images to the 2nd PPT via
> > VBA (i'm using VBA for the import/export).
>
> > tia,
> > mcnewsxp
>
> once confidured to do the import can it operate hands free?

my problem is i work in a federal government facility and software has
to go through a long approval process.

mcnewsxp

unread,
Nov 24, 2009, 10:10:19 AM11/24/09
to
here's what i did:
Sub AutomatePowerPoint()
' This requires that you set a reference to PowerPoint in Tools,
References
' You could later change these to As Object to avoid that necessity
Dim oPPTApp As PowerPoint.Application
Dim oPPTPres As PowerPoint.Presentation
Dim sPresentationFile As String
Dim nWhich As Integer
Dim oPicture As Shape
Dim FullPath As String
Dim FullPath2 As String
Dim oSl As Slide

FullPath = "C:\Temp\View45.PPT"

' Get a reference to PowerPoint app
Set oPPTApp = New PowerPoint.Application
' set it visible or you may get errors - there are ways around
this but they're
' beyond the scope of this FAQ
oPPTApp.Visible = True
' minimize if you want to hide it:
' oPPTApp.WindowState = ppWindowMinimized

' Open our source PPT file, get a reference to it
Set oPPTPres = oPPTApp.Presentations.Open(FullPath)

For nWhich = 1 To oPPTPres.Slides.Count
FullPath2 = "G:\FLU\dwweb\flu_live\weekly\UpdateTools\Graphics
\Slide" & nWhich & ".gif"
oPPTApp.ActiveWindow.View.GotoSlide nWhich
oPPTApp.ActiveWindow.Selection.SlideRange.Shapes(1).Select
oPPTApp.ActiveWindow.Selection.ShapeRange.Delete

' Set this to the full path to picture.

' Change slide index position to the first slide
oPPTApp.ActiveWindow.View.GotoSlide nWhich
' Set oSlide to the first slide in the presentation.
Set oSl = oPPTApp.ActiveWindow.Presentation.Slides(nWhich)
'Set oSl = ActiveWindow.Selection.SlideRange(nWhich)

' Insert the picture at an arbitrary size;
' PowerPoint requires you to supply *some* height and width for
the picture
Set oPicture = oSl.Shapes.AddPicture(fileName:=FullPath2, _
LinkToFile:=False, _
SaveWithDocument:=True, _
Left:=0, Top:=0, _
Width:=720, Height:=540)
Next nWhich

With oPPTPres ' Do stuff ...
' Show the number of slides in the file, for example
MsgBox .Slides.Count
End With

' Cleanup
Set oPicture = Nothing
Set oSl = Nothing
' Close the presentation
oPPTPres.Close
' Quit PPT
oPPTApp.Quit
' Release variables
Set oPPTPres = Nothing
Set oPPTApp = Nothing
Exit Sub
End Sub

Michael Koerner

unread,
Nov 24, 2009, 10:07:17 AM11/24/09
to
I know the feeling. I worked for the government for 40 years <g> Steve has
offered an alternate solution which will work well in your situation.

--
Michael Koerner
MS MVP - PowerPoint

"mcnewsxp" <mcou...@mindspring.com> wrote in message

news:becdc781-a587-4e77...@f20g2000vbl.googlegroups.com...

Steve Rindsberg

unread,
Nov 24, 2009, 10:22:13 AM11/24/09
to
In article <a4db5844-bf69-40d4-9551-

ded5b9...@x16g2000vbk.googlegroups.com>, Mcnewsxp wrote:
> On Nov 23, 2:58 pm, Steve Rindsberg <ab...@localhost.com> wrote:
> > In article <6d4a3997-bd57-40ce-9d68-
> >
> > 98eced00d...@j9g2000vbp.googlegroups.com>, Mcnewsxp wrote:
> > > i have to import some images to an existing PPT then export them so
> > > thet the background image is retained, then import them into another
> > > PPT for distribution. this is so the background branding is retained
> ..

> > > so 2 questions:
> > > 1) is there an easy smart way to do this\
> >
> > Here's some code that will help with importing the images:
> >
> > Batch Insert a folder full of pictures, one per slidehttp://www.pptfaq.co
> m/FAQ00352.htm
> >
> > > 2) or is there an way to export the saved images to the 2nd PPT via
> > > VBA (i'm using VBA for the import/export).
> >
> > Use the .Export method on each slide you want to export.
> >
> > Export slides as graphicshttp://www.pptfaq.com/FAQ00022.htm
> >
> > ========================
> ======
> > PPT Frequently Asked Questionshttp://www.pptfaq.com/
> >
> > PPTools add-ins for PowerPointhttp://www.pptools.com/
>
> thanks for the code. what i have in my PPT is very similar. what i
> need is a way to import the saved images into another PPT file, but
> the import is control by VBA code from the original PPT file.

Assuming you've read the Batch Insert link, what's preventing you from doing
that?

Instead of inserting pictures into the active presentation, your code can use
Presentations.Open to create a new presentation object and insert the images
into that instead. That'll give you pictures but no macros.

>the 2nd
> PPT file will be distributed to multiple users and i do not want the
> macro enable/disable dialog box to appear like it does when you have
> VBA modules in your PPT file.

mcnewsxp

unread,
Nov 24, 2009, 11:30:18 AM11/24/09
to
On Nov 24, 10:22 am, Steve Rindsberg <ab...@localhost.com> wrote:
> In article <a4db5844-bf69-40d4-9551-

yerp - that's what i did.
thanks.

Steve Rindsberg

unread,
Nov 25, 2009, 10:34:57 AM11/25/09
to
In article <da37d7ac-3352-4c37-939c-

bcd356...@m11g2000vbo.googlegroups.com>, Mcnewsxp wrote:
> here's what i did:

Thanks for posting the final result. A couple suggestions interspersed
below:

.Count is a Long so I'd dim nWhich as a Long also.
Then I'd use ...\Slide & Cstr(nWhich) ... to explicitly convert the Long
to a string when creating the file name.

VB will implicitly do the conversions for you, and in this case it
really doesn't matter much, but in other cases you can walk yourself
into some really obscure bugs this way. Best to take VB by the collar
and shake it 'till it does what you want it to. ;-)

> oPPTApp.ActiveWindow.View.GotoSlide nWhich
> oPPTApp.ActiveWindow.Selection.SlideRange.Shapes(1).Select
> oPPTApp.ActiveWindow.Selection.ShapeRange.Delete

You can replace the three lines above with:

With oPPTApp
.Slides(nWhich).Shapes(1).Delete
End With

You can directly address any shape on any slide like this ... no need to
go to the slide, no need to select the shape. And this'll be
considerably faster.


> ' Set this to the full path to picture.
>
> ' Change slide index position to the first slide
> oPPTApp.ActiveWindow.View.GotoSlide nWhich
> ' Set oSlide to the first slide in the presentation.
> Set oSl = oPPTApp.ActiveWindow.Presentation.Slides(nWhich)
> 'Set oSl = ActiveWindow.Selection.SlideRange(nWhich)

Likewise:

Set oSl = oPPTApp.Slides(nWhich)

No need to GoTo the slide or to work with selections.

0 new messages