Oh, am I in a mess...Need VBA help...again.

G

Guest

Okay, I screwed up royally. I thought the best solution would be to use tags,
then copy the slides that were tagged for the particular presentations, and
paste them into a new, blank presentation.

Except all of my formatting goes to pot! Backgrounds are no biggie, the
GrandMaster of PowerPoint helped me with that one. But the font sizes, the
line breaks, THAT all goes. I tried using:

Private Sub CommandButton1_Click()
Set oMasterPres = Presentations.Open("C:\employee_edu.ppt")
' Open the MasterPresentation
masterlist
Dim oNewPres As Presentation
Dim oNewSld As Slide
Dim oMasterSld As Slide
Dim sSlideType As String
' Create a new presentation
Set oNewPres = Presentations.Add
For Each oMasterSld In oMasterPres.Slides
If InStr(oMasterSld.Tags("IncludeIn"), "A") > 0 Then
oMasterSld.Copy
With oNewPres.Slides.Paste
.Design = oMasterPres.Design
.ColorScheme = oMasterPres.ColorScheme
End With
End If
Next
' Master Slide
' close the master presentation
oMasterPres.Close

But the fonts revert to whatever arbitrary default set in powerpoint. So I
looked at Shymalla's (forgive me if I butchered the spelling) solution, but I
don't see anything in there to keep the font size, and from what I saw when I
searched, I'm terrified it's not feasable...

SO would the solution, then, be to open my original, do a save-as as a
garbage file, then DELETE everything that was NOT tagged with "A", and then
continue on from there? I don't even know where to begin with that...

*sigh*
Oh, I have spent so many hours on this, my heart is in my shoes right now. I
am begging the PowerPoint Gods to help me bail myself out of this horrible,
dastardly, ill-conceived project! Me and my big "oh, I can help" MOUTH!
 
G

Guest

I realized, I asked for help and didn't provide all the info needed to
actually HELP me. That's what sheer panic'll do to you.

Question 1) If I have:

ActivePresentation.SaveAs FileName:="C:\project\temp.ppt"
is there a way to tell PowerPoint to go ahead and automatically overwrite
temp.ppt if it already exists?

Question 2)
I have tagged slides that look like this:
ActivePresentation.Slides(63).Tags.Add Name:="IncludeIn", Value:="ABCHJ"
ActivePresentation.Slides(64).Tags.Add Name:="IncludeIn", Value:="D"
ActivePresentation.Slides(65).Tags.Add Name:="IncludeIn", Value:="E"
ActivePresentation.Slides(66).Tags.Add Name:="IncludeIn", Value:="I"
ActivePresentation.Slides(67).Tags.Add Name:="IncludeIn", Value:="ABCDEFGHIJ"
ActivePresentation.Slides(68).Tags.Add Name:="IncludeIn", Value:="ABCDEFGHIJ"

I want to add vba code to a button that says, if this slide has "a" in the
tag "includeIn", go to the next slide. If it does NOT have "A" in the tag
"includeIn", delete the slide, and go on to the next one, so that what I have
left is all of the slides with only "A" in the tag (and of course, the next
button will have all of the "B" slides, and so on...

I hope that's clearer, and blessings upon the PowerPoint masters who've
gotten me this far...

(I shouldd'a stuck to HTML)
 
S

Steve Rindsberg

Question 1) If I have:

ActivePresentation.SaveAs FileName:="C:\project\temp.ppt"
is there a way to tell PowerPoint to go ahead and automatically overwrite
temp.ppt if it already exists?

It should do that automatically. It'll ask if it's ok to overwrite when saving
manually but not from code.
Question 2)
I have tagged slides that look like this:
ActivePresentation.Slides(63).Tags.Add Name:="IncludeIn", Value:="ABCHJ"
ActivePresentation.Slides(64).Tags.Add Name:="IncludeIn", Value:="D"
ActivePresentation.Slides(65).Tags.Add Name:="IncludeIn", Value:="E"
ActivePresentation.Slides(66).Tags.Add Name:="IncludeIn", Value:="I"
ActivePresentation.Slides(67).Tags.Add Name:="IncludeIn", Value:="ABCDEFGHIJ"
ActivePresentation.Slides(68).Tags.Add Name:="IncludeIn", Value:="ABCDEFGHIJ"

I want to add vba code to a button that says, if this slide has "a" in the
tag "includeIn", go to the next slide. If it does NOT have "A" in the tag
"includeIn", delete the slide, and go on to the next one, so that what I have
left is all of the slides with only "A" in the tag (and of course, the next
button will have all of the "B" slides, and so on...

I'm not sure I follow what you're after but for starters, this'll delete any
slide with "A" in the tag:

Dim x as long
For x = ActivePresentation.Slides.Count to 1 Step -1
With ActivePresentation.Slides(x)
If Instr(.Tags("IncludeIn"),"A") > 0 Then
.Delete
End If
End With
Next
 

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