From: Bob on 20 Jan 2006 14:24 Hot dog - a food thread! Let me ketchup on the notes, 'cause I relish talking with folks who can really cut the mustard. Hang onion - t'll only take a mint. OK, back to the tapioca - er... topic. For consistency, I always went to slide 1 before running the macro. In all cases, the new slide was added at the end. In short presentations, the text box was added on the last, new slide. In longer presentations, while the slide was added at the end, the text box was added to slide 1 (which *was* the slide I was on). My guess is that for longer presentations, when I was working with the Selection method, the program could not "get to" the last slide quickly enough and, so, worked on slide 1. Just to confuse things, I went back to my long test presentation and tried running the old macro from page 1 as well as from other pages. Running the macro from page 1 put the text box on page 1. Running it from other pages put the macro on the last slide! Re-running the macro from page 1 still put the text box on the last page!! Of course, the macro is working and I learned a lot, for which I am grateful, so this thread is now about how VBA works, but it's interesting, nonetheless. Thanks for the kelp - er... help, Bob "Steve Rindsberg" <abuse(a)localhost.com> wrote in message news:VA.00002052.179f68ec(a)localhost.com... > In article <egH98BdHGHA.1088(a)tk2msftngp13.phx.gbl>, Bob wrote: > > Arrggghhh.... I removed the ".Select" from the end of the line, but didn't > > rewrite the whole line. Bad editor. BAD! (woof, woof). > > > > Rewriting the line causes the macro now to place the text box on the last > > slide. More importantly, I understand why! What I don't understand is why > > the old code put the text box on the last slide in short presentations and > > on the first slide in longer presentations. Any ideas? > > Not offhand. I think it actually may have been putting the text box on > whatever slide you were on when you ran the code and that the length of the > presentation was a red herring. > > O no. I've set off a food thread! > > > BTW, thanks to your advice, I wrote a Word macro last night using discrete > > Dims and objects. It worked the first time! I will try to use objects, > > rather than selections, where possible in the future. > > > > Thanks! > > > > Bob > > > > "Steve Rindsberg" <abuse(a)localhost.com> wrote in message > > news:VA.0000204e.1414cb12(a)localhost.com... > > > In article <OeqsoAUHGHA.2472(a)TK2MSFTNGP10.phx.gbl>, Bob wrote: > > > > Thanks for all of the suggestions - they worked! I used objects and was > > > > able to get the macro working. Well, until I ran into one odd problem. > > > > When I run the macro in a short presentation (less than 10 or 11 > > slides), it > > > > does exactly what I want it to: > > > > > > > > 1) Gather all comments. > > > > 2) Insert new slide at end. > > > > 3) Insert text box on new slide. > > > > 4) Insert list of comments. > > > > > > > > If I run the macro in a longer presentation, it gathers the comments and > > > > inserts a new slide at the end, but it then puts the text box on the > > *first* > > > > slide! It does put the comments in the new text box, but why is the > > text > > > > box added to the first slide, not to the last? Why does the length of > > the > > > > presentation matter? > > > > > > Are you certain that's the problem? > > > Your code for adding the text box is dealing with the current SELECTION > > again. > > > Bad programmer. BAD! ;-) > > > > > > See the suggested change below: > > > > > > > Sub Comments2Slide() > > > > Dim SlideThis As Slide > > > > Dim CommentThis As Comment > > > > Dim CommentList As String > > > > Dim NumSlides As Long > > > > Dim SlideWidth As Long > > > > Dim SlideHeight As Long > > > > Dim CommentSlide As Slide > > > > Dim CommentTextBox As Shape > > > > NumSlides = ActivePresentation.Slides.Count > > > > SlideWidth = ActivePresentation.Slides(1).Master.Width > > > > SlideHeight = ActivePresentation.Slides(1).Master.Height > > > > ' Gather comments.................... > > > > For Each SlideThis In ActivePresentation.Slides > > > > For Each CommentThis In SlideThis.Comments > > > > CommentList = CommentList & "Slide #" & SlideThis.SlideNumber & > > " - > > > > " & CommentThis.Text & vbCrLf > > > > Next CommentThis > > > > Next SlideThis > > > > ' Create new slide.................... > > > > Set CommentSlide = ActivePresentation.Slides.Add(Index:=NumSlides + > > 1, > > > > Layout:=ppLayoutText) > > > > With CommentSlide > > > > .Layout = ppLayoutBlank > > > > .FollowMasterBackground = msoFalse > > > > > > > 'Create text box.................... > > > > > > Here's the problem > > > > > > > Set CommentTextBox = > > > > > > ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizo > > > > ntal, 0, 0, SlideWidth, SlideHeight) > > > > > > > > > try this: > > > > > > Set CommentTextBox = > > CommentSlide.Shapes.AddTextbox(msoTextOrientationHorizo > > > ntal, 0, 0, SlideWidth, SlideHeight) > > > > > > > > > Watch the line breaks ... that should all be on one line > > > > > > > With CommentTextBox > > > > .TextFrame.WordWrap = msoTrue > > > > .TextFrame.AutoSize = ppAutoSizeShapeToFitText > > > > .Fill.Transparency = 0# > > > > .Fill.Visible = msoTrue > > > > .Fill.Solid > > > > .Fill.ForeColor.RGB = RGB(255, 255, 255) > > > > .TextFrame.TextRange.Font.Color.RGB = RGB(0, 0, 0) > > > > ' Put comments in text box.................... > > > > .TextFrame.TextRange.Text = CommentList > > > > .TextFrame.TextRange.Font.Name = "Arial Narrow" > > > > .TextFrame.TextRange.Font.Size = 10 > > > > End With > > > > End With > > > > End Sub > > > > > > > > > > ----------------------------------------- > > > Steve Rindsberg, PPT MVP > > > PPT FAQ: www.pptfaq.com > > > PPTools: www.pptools.com > > > ================================================ > > > > > > > > > > ----------------------------------------- > Steve Rindsberg, PPT MVP > PPT FAQ: www.pptfaq.com > PPTools: www.pptools.com > ================================================ > >
From: Steve Rindsberg on 20 Jan 2006 08:03 In article <uoGuXcfHGHA.216(a)TK2MSFTNGP15.phx.gbl>, Bob wrote: > Hot dog - a food thread! Let me ketchup on the notes, 'cause I relish > talking with folks who can really cut the mustard. Hang onion - t'll only > take a mint. This is a very slippery slope. If you knew this group, you'd know how dangerous it is to start something like this! ;-) IAC, there's something odd going on re the current selection, and if you toss in different versions of PPT and depending on whether you've clicked a slide or the outliner or thumbnails on the left and which color socks you picked out this morning ... different stuff happens. Couldn't ask for a better demonstration of why Objects Are Good. <g> > > OK, back to the tapioca - er... topic. For consistency, I always went to > slide 1 before running the macro. In all cases, the new slide was added at > the end. In short presentations, the text box was added on the last, new > slide. In longer presentations, while the slide was added at the end, the > text box was added to slide 1 (which *was* the slide I was on). My guess is > that for longer presentations, when I was working with the Selection method, > the program could not "get to" the last slide quickly enough and, so, worked > on slide 1. > > Just to confuse things, I went back to my long test presentation and tried > running the old macro from page 1 as well as from other pages. Running the > macro from page 1 put the text box on page 1. Running it from other pages > put the macro on the last slide! Re-running the macro from page 1 still put > the text box on the last page!! > > Of course, the macro is working and I learned a lot, for which I am > grateful, so this thread is now about how VBA works, but it's interesting, > nonetheless. > > Thanks for the kelp - er... help, > Bob > > "Steve Rindsberg" <abuse(a)localhost.com> wrote in message > news:VA.00002052.179f68ec(a)localhost.com... > > In article <egH98BdHGHA.1088(a)tk2msftngp13.phx.gbl>, Bob wrote: > > > Arrggghhh.... I removed the ".Select" from the end of the line, but > didn't > > > rewrite the whole line. Bad editor. BAD! (woof, woof). > > > > > > Rewriting the line causes the macro now to place the text box on the > last > > > slide. More importantly, I understand why! What I don't understand is > why > > > the old code put the text box on the last slide in short presentations > and > > > on the first slide in longer presentations. Any ideas? > > > > Not offhand. I think it actually may have been putting the text box on > > whatever slide you were on when you ran the code and that the length of > the > > presentation was a red herring. > > > > O no. I've set off a food thread! > > > > > BTW, thanks to your advice, I wrote a Word macro last night using > discrete > > > Dims and objects. It worked the first time! I will try to use objects, > > > rather than selections, where possible in the future. > > > > > > Thanks! > > > > > > Bob > > > > > > "Steve Rindsberg" <abuse(a)localhost.com> wrote in message > > > news:VA.0000204e.1414cb12(a)localhost.com... > > > > In article <OeqsoAUHGHA.2472(a)TK2MSFTNGP10.phx.gbl>, Bob wrote: > > > > > Thanks for all of the suggestions - they worked! I used objects and > was > > > > > able to get the macro working. Well, until I ran into one odd > problem. > > > > > When I run the macro in a short presentation (less than 10 or 11 > > > slides), it > > > > > does exactly what I want it to: > > > > > > > > > > 1) Gather all comments. > > > > > 2) Insert new slide at end. > > > > > 3) Insert text box on new slide. > > > > > 4) Insert list of comments. > > > > > > > > > > If I run the macro in a longer presentation, it gathers the comments > and > > > > > inserts a new slide at the end, but it then puts the text box on the > > > *first* > > > > > slide! It does put the comments in the new text box, but why is the > > > text > > > > > box added to the first slide, not to the last? Why does the length > of > > > the > > > > > presentation matter? > > > > > > > > Are you certain that's the problem? > > > > Your code for adding the text box is dealing with the current > SELECTION > > > again. > > > > Bad programmer. BAD! ;-) > > > > > > > > See the suggested change below: > > > > > > > > > Sub Comments2Slide() > > > > > Dim SlideThis As Slide > > > > > Dim CommentThis As Comment > > > > > Dim CommentList As String > > > > > Dim NumSlides As Long > > > > > Dim SlideWidth As Long > > > > > Dim SlideHeight As Long > > > > > Dim CommentSlide As Slide > > > > > Dim CommentTextBox As Shape > > > > > NumSlides = ActivePresentation.Slides.Count > > > > > SlideWidth = ActivePresentation.Slides(1).Master.Width > > > > > SlideHeight = ActivePresentation.Slides(1).Master.Height > > > > > ' Gather comments.................... > > > > > For Each SlideThis In ActivePresentation.Slides > > > > > For Each CommentThis In SlideThis.Comments > > > > > CommentList = CommentList & "Slide #" & > SlideThis.SlideNumber & > > > " - > > > > > " & CommentThis.Text & vbCrLf > > > > > Next CommentThis > > > > > Next SlideThis > > > > > ' Create new slide.................... > > > > > Set CommentSlide = ActivePresentation.Slides.Add(Index:=NumSlides > + > > > 1, > > > > > Layout:=ppLayoutText) > > > > > With CommentSlide > > > > > .Layout = ppLayoutBlank > > > > > .FollowMasterBackground = msoFalse > > > > > > > > > 'Create text box.................... > > > > > > > > Here's the problem > > > > > > > > > Set CommentTextBox = > > > > > > > > > ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizo > > > > > ntal, 0, 0, SlideWidth, SlideHeight) > > > > > > > > > > > > try this: > > > > > > > > Set CommentTextBox = > > > CommentSlide.Shapes.AddTextbox(msoTextOrientationHorizo > > > > ntal, 0, 0, SlideWidth, SlideHeight) > > > > > > > > > > > > Watch the line breaks ... that should all be on one line > > > > > > > > > With CommentTextBox > > > > > .TextFrame.WordWrap = msoTrue > > > > > .TextFrame.AutoSize = ppAutoSizeShapeToFitText > > > > > .Fill.Transparency = 0# > > > > > .Fill.Visible = msoTrue > > > > > .Fill.Solid > > > > > .Fill.ForeColor.RGB = RGB(255, 255, 255) > > > > > .TextFrame.TextRange.Font.Color.RGB = RGB(0, 0, 0) > > > > > ' Put comments in text box.................... > > > > > .TextFrame.TextRange.Text = CommentList > > > > > .TextFrame.TextRange.Font.Name = "Arial Narrow" > > > > > .TextFrame.TextRange.Font.Size = 10 > > > > > End With > > > > > End With > > > > > End Sub > > > > > > > > > > > > > ----------------------------------------- > > > > Steve Rindsberg, PPT MVP > > > > PPT FAQ: www.pptfaq.com > > > > PPTools: www.pptools.com > > > > ================================================ > > > > > > > > > > > > > > > ----------------------------------------- > > Steve Rindsberg, PPT MVP > > PPT FAQ: www.pptfaq.com > > PPTools: www.pptools.com > > ================================================ > > > > > ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================
From: Echo S on 21 Jan 2006 13:31 "Bob" <wrong(a)invalid.net> wrote in message news:uoGuXcfHGHA.216(a)TK2MSFTNGP15.phx.gbl... > Hot dog - a food thread! Let me ketchup on the notes, 'cause I relish > talking with folks who can really cut the mustard. Hang onion - t'll only > take a mint. > > OK, back to the tapioca - er... topic. > Thanks for the kelp - er... help, ROFL! I dunno much about code, Bob, but it sounds to me as if something's definitely burgered somewhere. Totally fried, if you ask me. Kinda leaves you in a pickle, doesn't it? ;-) -- Echo [MS PPT MVP] http://www.echosvoice.com
From: Kathy Jacobs on 21 Jan 2006 13:41 "Echo S" <msnewsgroups(a)echosvoiceUGHSPAM.com> wrote in message news:OxS2fkrHGHA.3984(a)TK2MSFTNGP14.phx.gbl... > Kinda leaves you in a pickle, doesn't it? Sweet or dill? -- Kathryn Jacobs, Microsoft MVP PowerPoint and OneNote Author of Kathy Jacobs on PowerPoint - Available now from Holy Macro! Books Get PowerPoint answers at http://www.powerpointanswers.com I believe life is meant to be lived. But: if we live without making a difference, it makes no difference that we lived
From: Steve Rindsberg on 21 Jan 2006 04:51 > > Sweet or dill? > Takuon. Or the other. Or both. Gad zukes! ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Can we embed movie(mpg/mpeg) file in powerpoint? Next: Sales Funnel Template Slide |