TextFrame and VBA

J

Jeff Jones

ROTFL --- Unfortunately, I believe that you are correct about the
apps pushing. I don't think that developers, during initial unit
testing, really test their apps to break them. I suspect that they
test them to work. I think that they start with a set of
requirements, develop something to "satisfy" them, and then only test
the ability of the app to meet those requirements. They really ought
to spend time trying to figure out every possible way to do something
wrong. In other words, they need to act like a user who hasn't a
clue. This will open up the areas that need be plugged in terms of
unexpected features. Oh well......

Now, lets talk about COBOL....... (shows my age, huh? LOL )
 
J

Jeff Jones

Streve,

I believe that, at least until I find the need, I can declare victory
with the following code.


Sub TestShapes()

Dim numShapes, numAutoShapes, i As Long
Dim oSld As Slide
Dim oTxtRange As TextRange
Dim varTextFrame As Variant

On Error GoTo HandleError
Stop
StartAgain:
Set myDocument =
ActivePresentation.Slides(ActivePresentation.Slides.Count)
With myDocument.Shapes
numShapes = .Count
If numShapes > 1 Then
numTextShapes = 0
For i = 1 To numShapes - 1
If .Item(i).HasTextFrame Then
' If .Item(i).HasText Then
numTextShapes = numTextShapes + 1
varTextFrame = .Item(i).Name

ActiveWindow.View.GotoSlide
Index:=ActivePresentation.Slides.Count
Set oSld =
ActivePresentation.Slides(ActivePresentation.Slides.Count)


ActiveWindow.Selection.SlideRange.Shapes(varTextFrame).Select

Set oTxtRange =
oSld.Shapes(varTextFrame).TextFrame.TextRange

If Mid$(oTxtRange.Sentences(1), 1, Len("America"))
=
"America" Then
With oTxtRange.Sentences(1) _
.ActionSettings(ppMouseClick).Hyperlink
.Address = "http://www.gsms-am.eds.com/
<http://www.gsms-am.eds.com/> "
.TextToDisplay = "Americas:
http://www.gsms-am.eds.com <http://www.gsms-am.eds.com> " & vbNewLine
.SubAddress = ""
End With

With oTxtRange.Sentences(2) _
.ActionSettings(ppMouseClick).Hyperlink
.Address = "http://www.gsms-ap.eds.com/
<http://www.gsms-ap.eds.com/> "
.TextToDisplay = "Asia Pacific:
http://www.gsms-ap.eds.com <http://www.gsms-ap.eds.com> " & vbNewLine
.SubAddress = ""
End With
With oTxtRange.Sentences(3) _
.ActionSettings(ppMouseClick).Hyperlink
.Address = "http://www.gsms-ea.eds.com/
<http://www.gsms-ea.eds.com/> "
.TextToDisplay = "Europe & Africa:
http://www.gsms-ea.eds.com <http://www.gsms-ea.eds.com> "
.SubAddress = ""
End With
End If
' Else
' DeletEmptyShapes
' End If
End If
NextFor:
Next
End If
End With

Exit Sub

HandleError:
'Stop
If Err.Number = 9 Then
GoTo NextFor
End If
' Resume

'If Err.Number <> 0 Then
' Msg = "Error # " & Str(Err.Number) & " was generated by " _
' & Err.Source & Chr(13) & Err.Description
' MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
'End If

CopyLastSlide
GoTo StartAgain

End Sub


Sub CopyLastSlide()
'
' Macro created 1/18/2005 by Jeff Jones
'
Windows.Item(Index:=2).Activate
ActiveWindow.ViewType = ppViewSlideSorter
ActiveWindow.Selection.Copy
ActiveWindow.ViewType = ppViewNormal
Windows.Item(Index:=2).Activate
ActiveWindow.View.Paste

ActiveWindow.ViewType = ppViewSlideSorter

ActivePresentation.Slides.Range(Array((ActivePresentation.Slides.Count
-
1))).Select
ActiveWindow.Selection.SlideRange.Delete
ActiveWindow.ViewType = ppViewNormal
ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Count

End Sub

I tried commenting out the SlideGoTo and the TextFrame selection but
ended up with errors I couldn't trap so I left them in. Oh well. I
tested against 33 of the 150+ presentations with no problems. I
suspect that I'll find other opportunities but for the most part, the
entire effort will be automated and therefore much preferable over
manually making the changes.

Thank you!

Take care,
Jeff
 
S

Steve Rindsberg

In other words, they need to act like a user who hasn't a
clue. This will open up the areas that need be plugged in terms of
unexpected features.

Too true. I make the same mistake all the time. Stuff works perfectly for me
because I do things the way *I* do them. Give the same code to another user who
holds their mouth a little differently when they doubleclick something and ...
ooopsie!
Now, lets talk about COBOL....... (shows my age, huh? LOL )

Awww bummer. I took the Fortran course instead of Cobol. Darn.
 
K

Kathy J

Now, lets talk about COBOL....... (shows my age, huh? LOL )
Awww bummer. I took the Fortran course instead of Cobol. Darn.
Me, I took em both. I even had to take the Cobol one twice. (Long story, but
it was fun correcting the prof the second time through:) )

--
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
 
J

Jeff Jones

I can only declare victory because of your help!

It's too bad that you took the Fortran course. 'Course it coulda
been Assembler or some other somewhet useful language like AdPac or
Ramis.

Thnak you for your invaluable help!
 
S

Steve Rindsberg

It's too bad that you took the Fortran course. 'Course it coulda
been Assembler or some other somewhet useful language like AdPac or
Ramis.

Hm. How about a language called Dissembler? Never gives the same answer twice
in a row.
 
S

Steve Rindsberg

Awww bummer. I took the Fortran course instead of Cobol. Darn.
Me, I took em both. I even had to take the Cobol one twice. (Long story, but
it was fun correcting the prof the second time through:) )

Cobol seemed SO longwinded. We had to enter everything onto punchcards; bad
enough in Fortran. I'd still be punching at it if I'd done Cobol!
 
K

Kathy J

We were on punch cards. First time through, that was part of the problem.
Second time through, we had moved to a VAX and I was one of the few who
started the school year already knowing how to use the machine. COBOL was
long-winded. But it isn't as bad as, say, PL/1 or PL/C....

--
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
 
S

Steve Rindsberg

LOL. That actually sounds more like a politician running for an
election.....

Dissembler's a favorite for crafting political mailmerge apps.
It's lips even move when it prints.
 
J

Jeff Jones

I agree Kathy, I never liked PL/1 ....

Paper tape and data cells were still in use when I started. All
applications were on punch cards. If the programmer were smart, the
cards would have sequence numbers in columns 73 through 80 because
inevitably the deck would be dropped. Then the cards could go to the
collator to be re-sequenced. Those were the days that people carried
IBM cards in their pocket to make notes and everyone had a green card
to do hexadecimal translations and other important machine functions.
I actually still have an actual green card.
 
J

Jeff Jones

I agree Kathy, I never liked PL/1 ....

Paper tape and data cells were still in use when I started. All
applications were on punch cards. If the programmer were smart, the
cards would have sequence numbers in columns 73 through 80 because
inevitably the deck would be dropped. Then the cards could go to the
collator to be re-sequenced. Those were the days that people carried
IBM cards in their pocket to make notes and everyone had a green card
to do hexadecimal translations and other important machine functions.
I actually still have an actual green card.
 
J

Jeff Jones

I agree Kathy, I never liked PL/1 ....

Paper tape and data cells were still in use when I started. All
applications were on punch cards. If the programmer were smart, the
cards would have sequence numbers in columns 73 through 80 because
inevitably the deck would be dropped. Then the cards could go to the
collator to be re-sequenced. Those were the days that people carried
IBM cards in their pocket to make notes and everyone had a green card
to do hexadecimal translations and other important machine functions.
I actually still have a real green card.
 
K

Kathy J

Hey Jeff - We still have punch cards around here somewhere. Want some?
My husband says that assembler is worse than COBOL when using punchcards...
One little change and....ARGUH!

--
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
 
J

Jeff Jones

Hi Kathy,
I suspect that I've still got one 2-inch deck of cards here,
just for old times sake. It's next to my green card and a 8.5 inch
mag tape with important stuff on it that I can't get to and haven't
been able to for years.

Thanks for the offer but sticky tabs have replaced the
80-column cards.

I agree that Assembler was MUCH worse than COBOL. I actually
liked COBOL, especially COBOL II. The in-line performs were kewl....
If done correctly COBOL was self-documenting. However there were far
too many programmers who followed assembler conventions in COBOL to
the self-documenting feature was absent. I used to sit at my desk and
"play computer" to try to figure out what the program was doing.
 
M

Mike M.

Wow! You guys had cards and tape?! We had to wire every instruction on a
large panel of electrical contacts. Key punches and cards must have been so
nice!
 
S

Steve Rindsberg

Wow! You guys had cards and tape?! We had to wire every instruction on a
large panel of electrical contacts. Key punches and cards must have been so
nice!


You had wire? And instructions? Probably only walked twenty miles each way to
school in snow no higher than your chin too. We had to stick metal rods
through our decks of cards and LIFT. You kids had it easy!

Your pal,
Herman Hollerith

Ah, Monsieur Hollerith is a good fellow but he doesn't know how easy his life
was. Cards? We only had stacks of wooden slabs. And we had to run thread
every which way through them before we could think of starting. And they kept
the machinery atop a mountain we had to climb every morning. Barefoot.
Through thorns that grew atop the icepack.

Bonjour,
Joseph Jacquard
 

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