|
From: Jeff on 14 Feb 2005 12:20 I have a powerpoint slide with a table. The following code returns the value 19 which indicates the shape is a table MsgBox ActivePresentation.Slides(1).Shapes(1).Type The shape types are enumerated under the MsoShapeType class and the value of 19 is assigned to msoTable. Is there a simple command that will return "msoTable" instead of it's value of 19? Thanks... Jeff
From: David M. Marcovitz on 14 Feb 2005 12:38 I don't know for sure, but I don't think that is possible. I believe that the compiler automatically converts any constants (like msoTable) to their corresponding value (19 in this case). When it is running, PowerPoint/VBA has no way of knowing that the 19 it is looking at came from msoTable instead of msoSomethingElse. You can, of course, compare the value returned to msoTable, rather than 19 as in If ActivePresentation.Slides(1).Shapes(1).Type = msoTable Then msgBox "Look ma! It's a table, an msoTable, that is." Else msgBox "This ain't no darn table." End If --David -- David M. Marcovitz Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.loyola.edu/education/PowerfulPowerPoint/ "Jeff" <eatmy(a)grits.com> wrote in news:#hJ78lrEFHA.2176(a)TK2MSFTNGP15.phx.gbl: > I have a powerpoint slide with a table. The following code returns > the value 19 which indicates the shape is a table > > MsgBox ActivePresentation.Slides(1).Shapes(1).Type > > The shape types are enumerated under the MsoShapeType class and the > value of 19 is assigned to msoTable. Is there a simple command that > will return "msoTable" instead of it's value of 19? > > Thanks... > > Jeff > > >
From: Jeff on 14 Feb 2005 13:11 WOW, thanks for the fast reply! (I read your book, by the way.) I'm writing a procedure that will list all the shapes in a given presentation. Right now, the only way I can figure to do it is to retype all the mso shape constants into a Select Case statement. I was hoping there was a better way to work with an enum type without having to type all those constants into a VBA procedure. I wrote a simple Access program that gives multiple choice quizzes and I wondered if I could do the same thing in Powerpoint. Your book came out just in time and it was fun reading, but unfortunately it was made for total beginners who only have a handful of questions to present instead of hundreds like I have. All my questions are in an Access table. I don't know if I should write it all in Powerpoint or do it in Access and call the Powerpoint objects when needed. I'd rather just do it in Powerpoint. Seems like it would be less clunky that way. Do you know anyone who's done a multiple choice quiz program in Powerpoint where the questions are retrieved from an Access table? Jeff "David M. Marcovitz" <marcoNOSPAM(a)loyola.edu> wrote in message news:Xns95FD8095C8611marcoNOSPAMloyolaedu(a)207.46.248.16... > I don't know for sure, but I don't think that is possible. I believe that > the compiler automatically converts any constants (like msoTable) to > their corresponding value (19 in this case). When it is running, > PowerPoint/VBA has no way of knowing that the 19 it is looking at came > from msoTable instead of msoSomethingElse. You can, of course, compare > the value returned to msoTable, rather than 19 as in > > If ActivePresentation.Slides(1).Shapes(1).Type = msoTable Then > msgBox "Look ma! It's a table, an msoTable, that is." > Else > msgBox "This ain't no darn table." > End If > > --David > > -- > David M. Marcovitz > Director of Graduate Programs in Educational Technology > Loyola College in Maryland > Author of _Powerful PowerPoint for Educators_ > http://www.loyola.edu/education/PowerfulPowerPoint/ > > "Jeff" <eatmy(a)grits.com> wrote in > news:#hJ78lrEFHA.2176(a)TK2MSFTNGP15.phx.gbl: > > > I have a powerpoint slide with a table. The following code returns > > the value 19 which indicates the shape is a table > > > > MsgBox ActivePresentation.Slides(1).Shapes(1).Type > > > > The shape types are enumerated under the MsoShapeType class and the > > value of 19 is assigned to msoTable. Is there a simple command that > > will return "msoTable" instead of it's value of 19? > > > > Thanks... > > > > Jeff > > > > > > >
From: David M. Marcovitz on 14 Feb 2005 13:26 Yes, I think the Case statement is the way you will have to go, unless someone else here has better information. Bill Foley is the other PowerPoint/VBA Quiz expert here. I don't know if he has done what you want with linking PowerPoint and Access. It is certainly possible, but I have never done it. I have created quizzes by reading the questions from a text file. I could imagine that it wouldn't be too hard to create an Access database of quiz questions, use queries to pick the questions you want and dump the results to a text file that could be read by PowerPoint. This is probably a convoluted way to do this, but if you're interested in pursuing it, here is some simple code that reads the first line of a text file as the question and the next two lines as the answers and then adjusts the question on slide 2: Sub AdjustQuestion() Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fs, f Dim theQuestion As String Dim answer1 As String Dim answer2 As String Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.OpenTextFile("mytestfile.txt", ForReading, TristateFalse) theQuestion = f.readline answer1 = f.readline answer2 = f.readline ActivePresentation.Slides(2).Shapes(1).TextFrame.TextRange.Text _ = theQuestion ActivePresentation.Slides(2).Shapes(2).TextFrame.TextRange.Text _ = answer1 ActivePresentation.Slides(2).Shapes(3).TextFrame.TextRange.Text _ = answer2 f.Close End Sub I'm glad you enjoyed my book. I also would be interested in someone taking this to the next level and writing a more advanced book, but, for the time being, that someone isn't me. --David -- David M. Marcovitz Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.loyola.edu/education/PowerfulPowerPoint/ "Jeff" <eatmy(a)grits.com> wrote in news:OqcVYCsEFHA.3840(a)tk2msftngp13.phx.gbl: > WOW, thanks for the fast reply! (I read your book, by the way.) I'm > writing a procedure that will list all the shapes in a given > presentation. Right now, the only way I can figure to do it is to > retype all the mso shape constants into a Select Case statement. I > was hoping there was a better way to work with an enum type without > having to type all those constants into a VBA procedure. > > I wrote a simple Access program that gives multiple choice quizzes and > I wondered if I could do the same thing in Powerpoint. Your book came > out just in time and it was fun reading, but unfortunately it was made > for total beginners who only have a handful of questions to present > instead of hundreds like I have. All my questions are in an Access > table. I don't know if I should write it all in Powerpoint or do it > in Access and call the Powerpoint objects when needed. I'd rather > just do it in Powerpoint. Seems like it would be less clunky that > way. Do you know anyone who's done a multiple choice quiz program in > Powerpoint where the questions are retrieved from an Access table? > > Jeff > > "David M. Marcovitz" <marcoNOSPAM(a)loyola.edu> wrote in message > news:Xns95FD8095C8611marcoNOSPAMloyolaedu(a)207.46.248.16... >> I don't know for sure, but I don't think that is possible. I believe >> that the compiler automatically converts any constants (like >> msoTable) to their corresponding value (19 in this case). When it is >> running, PowerPoint/VBA has no way of knowing that the 19 it is >> looking at came from msoTable instead of msoSomethingElse. You can, >> of course, compare the value returned to msoTable, rather than 19 as >> in >> >> If ActivePresentation.Slides(1).Shapes(1).Type = msoTable Then >> msgBox "Look ma! It's a table, an msoTable, that is." >> Else >> msgBox "This ain't no darn table." >> End If >> >> --David >> >> -- >> David M. Marcovitz >> Director of Graduate Programs in Educational Technology >> Loyola College in Maryland >> Author of _Powerful PowerPoint for Educators_ >> http://www.loyola.edu/education/PowerfulPowerPoint/ >> >> "Jeff" <eatmy(a)grits.com> wrote in >> news:#hJ78lrEFHA.2176(a)TK2MSFTNGP15.phx.gbl: >> >> > I have a powerpoint slide with a table. The following code returns >> > the value 19 which indicates the shape is a table >> > >> > MsgBox ActivePresentation.Slides(1).Shapes(1).Type >> > >> > The shape types are enumerated under the MsoShapeType class and the >> > value of 19 is assigned to msoTable. Is there a simple command >> > that will return "msoTable" instead of it's value of 19? >> > >> > Thanks... >> > >> > Jeff >> > >> > >> > >> > > >
From: Lance Wynn on 14 Feb 2005 14:03 You may want to look into the TypeLib Information library (tlbInf32.dll). I don't know how well it will work through VBA, but it should do fine, VBA is just like any other ActiveX language I think. I've used it to enumerate constants, enums, and method names. I haven't found a lot of great documentation for it though, but check on google, and you should find some sample code. Lance "David M. Marcovitz" <marcoNOSPAM(a)loyola.edu> wrote in message news:Xns95FD88A8B7E31marcoNOSPAMloyolaedu(a)207.46.248.16... Yes, I think the Case statement is the way you will have to go, unless someone else here has better information. Bill Foley is the other PowerPoint/VBA Quiz expert here. I don't know if he has done what you want with linking PowerPoint and Access. It is certainly possible, but I have never done it. I have created quizzes by reading the questions from a text file. I could imagine that it wouldn't be too hard to create an Access database of quiz questions, use queries to pick the questions you want and dump the results to a text file that could be read by PowerPoint. This is probably a convoluted way to do this, but if you're interested in pursuing it, here is some simple code that reads the first line of a text file as the question and the next two lines as the answers and then adjusts the question on slide 2: Sub AdjustQuestion() Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fs, f Dim theQuestion As String Dim answer1 As String Dim answer2 As String Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.OpenTextFile("mytestfile.txt", ForReading, TristateFalse) theQuestion = f.readline answer1 = f.readline answer2 = f.readline ActivePresentation.Slides(2).Shapes(1).TextFrame.TextRange.Text _ = theQuestion ActivePresentation.Slides(2).Shapes(2).TextFrame.TextRange.Text _ = answer1 ActivePresentation.Slides(2).Shapes(3).TextFrame.TextRange.Text _ = answer2 f.Close End Sub I'm glad you enjoyed my book. I also would be interested in someone taking this to the next level and writing a more advanced book, but, for the time being, that someone isn't me. --David -- David M. Marcovitz Director of Graduate Programs in Educational Technology Loyola College in Maryland Author of _Powerful PowerPoint for Educators_ http://www.loyola.edu/education/PowerfulPowerPoint/ "Jeff" <eatmy(a)grits.com> wrote in news:OqcVYCsEFHA.3840(a)tk2msftngp13.phx.gbl: > WOW, thanks for the fast reply! (I read your book, by the way.) I'm > writing a procedure that will list all the shapes in a given > presentation. Right now, the only way I can figure to do it is to > retype all the mso shape constants into a Select Case statement. I > was hoping there was a better way to work with an enum type without > having to type all those constants into a VBA procedure. > > I wrote a simple Access program that gives multiple choice quizzes and > I wondered if I could do the same thing in Powerpoint. Your book came > out just in time and it was fun reading, but unfortunately it was made > for total beginners who only have a handful of questions to present > instead of hundreds like I have. All my questions are in an Access > table. I don't know if I should write it all in Powerpoint or do it > in Access and call the Powerpoint objects when needed. I'd rather > just do it in Powerpoint. Seems like it would be less clunky that > way. Do you know anyone who's done a multiple choice quiz program in > Powerpoint where the questions are retrieved from an Access table? > > Jeff > > "David M. Marcovitz" <marcoNOSPAM(a)loyola.edu> wrote in message > news:Xns95FD8095C8611marcoNOSPAMloyolaedu(a)207.46.248.16... >> I don't know for sure, but I don't think that is possible. I believe >> that the compiler automatically converts any constants (like >> msoTable) to their corresponding value (19 in this case). When it is >> running, PowerPoint/VBA has no way of knowing that the 19 it is >> looking at came from msoTable instead of msoSomethingElse. You can, >> of course, compare the value returned to msoTable, rather than 19 as >> in >> >> If ActivePresentation.Slides(1).Shapes(1).Type = msoTable Then >> msgBox "Look ma! It's a table, an msoTable, that is." >> Else >> msgBox "This ain't no darn table." >> End If >> >> --David >> >> -- >> David M. Marcovitz >> Director of Graduate Programs in Educational Technology >> Loyola College in Maryland >> Author of _Powerful PowerPoint for Educators_ >> http://www.loyola.edu/education/PowerfulPowerPoint/ >> >> "Jeff" <eatmy(a)grits.com> wrote in >> news:#hJ78lrEFHA.2176(a)TK2MSFTNGP15.phx.gbl: >> >> > I have a powerpoint slide with a table. The following code returns >> > the value 19 which indicates the shape is a table >> > >> > MsgBox ActivePresentation.Slides(1).Shapes(1).Type >> > >> > The shape types are enumerated under the MsoShapeType class and the >> > value of 19 is assigned to msoTable. Is there a simple command >> > that will return "msoTable" instead of it's value of 19? >> > >> > Thanks... >> > >> > Jeff >> > >> > >> > >> > > >
|
Next
|
Last
Pages: 1 2 Prev: Double clicking in PowerPoint Next: how to animate one word in a bulleted sentence |