powerpoint >> word lists inported from a macro

by TWNEb3VnaGFsbA » Mon, 24 Aug 2009 23:35:01 GMT

I posted this question last week but can't find so I'm wondering if it didn't
post.

Anyway, I am created several PPT presentations for typists that feature word
lists. The lists exist as text files and I have a macro to import them into
PPT.

However, in the first version of the macro the words would show up at the on
the slide but be bulleted, I did not want the bullet.

Revised the macro to changed the slide style to use titleonly but now the
text is right at the top of the slide - but no more bullet - so progress.

Macro text:


Sub HeadingsAndTextFromFile()

' Purpose:
' Read a plain text file like this:

'Heading1
'Text that's to appear under heading 1
'Heading2
'Text that's to appear under heading 2
'Heading3
'And so on

' And convert it to a presentation with one slide per Heading in the file

Dim sFileName As String
Dim iFileNum As Integer
Dim sText As String
Dim oSl As Slide

If Presentations.Count = 0 Then
MsgBox "Open a presentation then try again"
Exit Sub
End If

' EDIT THIS TO REFLECT THE NAME AND LOCATION
' OF THE TEXT FILE YOU WANT TO USE:
sFileName = "Path to document"

iFileNum = FreeFile()
Open sFileName For Input As iFileNum

' Use the current presentation
With ActivePresentation.SlideMaster _
.TextStyles(ppBodyStyle).Levels(1)
With .Font
.Name = "Arial"
.Size = 80
End With
With .ParagraphFormat
.LineRuleBefore = False
.SpaceBefore = 14
.Alignment = ppAlignCenter
End With
End With
Note: since changing the macro the above no longer seems to change the font
size/style
With ActivePresentation
Do While Not EOF(iFileNum)
Line Input #iFileNum, sText
Set oSl = .Slides.Add(.Slides.Count + 1, ppLayoutTitleOnly)
With oSl
' Relying on shape names is a bit risky but since we've
' just created the slide, the defaults should be safe:
.Shapes.Title.TextFrame.TextRange.Text = sText
End With
Loop
End With

Set oSl = Nothing
Close iFileNum

End Sub

Now I just want to centre the text on the screen.

Do I need to change the style type again (to perhaps title instead of title
only) or is there a way that I can format the title only style to centre the
text box?

I will inclose my macro if anyone can suggest a change to provide get the
text centred in the window, I would appreciate it.

Thanks.

--
Teaching others to help themselves

powerpoint >> RE: word lists inported from a macro

by Sm9obiBXaWxzb24 » Tue, 25 Aug 2009 01:01:03 GMT


IIRC Steve suggested in your other post to forget the master and just add a
textbox

Maybe this sort of thing

Sub addtext()

Dim sFileName As String
Dim iFileNum As Integer
Dim sText As String
Dim oSl As Slide
Dim oSh As Shape

If Presentations.Count = 0 Then
MsgBox "Open a presentation then try again"
Exit Sub
End If

' EDIT THIS TO REFLECT THE NAME AND LOCATION
' OF THE TEXT FILE YOU WANT TO USE:
sFileName = "Path to File"

iFileNum = FreeFile()
Open sFileName For Input As iFileNum

' Use the current presentation

With ActivePresentation
Do While Not EOF(iFileNum)
Line Input #iFileNum, sText
Set oSl = .Slides.Add(.Slides.Count + 1, ppLayoutBlank)
Set oSh = oSl.Shapes.AddTextbox(msoTextOrientationHorizontal, _
10, 10, 600, 50)
With oSh.TextFrame.TextRange
.Text = sText
.ParagraphFormat.Alignment = ppAlignCenter
.ParagraphFormat.Bullet = False
.Font.Name = "Arial"
.Font.Size = 44
End With
'center
With oSl.Shapes.Range(1)
.Align (msoAlignCenters), True
.Align (msoAlignMiddles), True

End With
Loop
End With

Set oSl = Nothing
Close iFileNum

End Sub
--
john ATSIGN PPTAlchemy.co.uk

Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
PPTLive Atlanta Oct 11-14 2009

powerpoint >> RE: word lists inported from a macro

by TWNEb3VnaGFsbA » Tue, 25 Aug 2009 01:10:02 GMT

John,

Thank you for your response, I looked all over this morning but couldn't
find my original question. Your answer is exactly what I was looking for,

Thanks

--
Teaching others to help themselves

Similar Threads

1. Addin macros run from toolbar but not shown in macro list

2. Powerpoint slide show from list, with macro?

Version: 2004
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

I would like to have a slideshow created from a list of slide names. Is there any way to do this, using VBA?
The list is generated by a macro in Excel.
It's customized for each person (removing any unfamiliar slides) from a standard set of pictures.
If Powerpoint cannot read picture file names from a list, any suggestions about how to do this?
I suppose a macro could go down the list and delete the corresponding picture.
This would not allow randomizing the order howere, as being able to INSERT a picture from the list would.
I suppose therefore a macro could go down the list and INSERT the picture with that file name.
I have experience with Excel macros, none yet with Powerpoint, so any suggestions about how to accomplish this will be very appreciated.

3. Awesome list of Excel/Word/Powerpoint shortcuts! - Excel

4. word list circles

How do I use a list of words to form a circle with the words?

5. Importing List of Words from Excel to PP

6. Numbered list - bold first word

Hi all

A silly problem
I have a numbered list, in which one of the items starts with a bold-formatted word
Problem is, the item's number insists of having the exact same formatting as the first letter, and I want it to have normal formatting
Is there any way to do this

Thanks
iloop

7. numbered lists and sending notes to Word

8. Populating PP presentation with a word list

I am creating a series of word list drills for typing students, using 
powerpoint to present the drills.  I have a macro that will take a list of 
works from a text file and import them one per slide to the presentation.

I'm using a TitleOnly slide layout but I want to centre the text on the 
page, instead of having the line of text at the top of the page.

I tried adding increment commands and even recorded a centering action of 
manually centering the text box on the slide but when I run the parent macro, 
it does not pick up the centering command.

My Macro is below: 


Sub HeadingsAndTextFromFile()

' Purpose:
' Read a plain text file 
' And convert it to a presentation with one slide per Heading in the file

Dim sFileName As String
Dim iFileNum As Integer
Dim sText As String
Dim oSl As Slide

If Presentations.Count = 0 Then
    MsgBox "Open a presentation then try again"
    Exit Sub
End If

' EDIT THIS TO REFLECT THE NAME AND LOCATION
' OF THE TEXT FILE YOU WANT TO USE:
sFileName = "filepathe:/list.txt"

iFileNum = FreeFile()
Open sFileName For Input As iFileNum

' Use the current presentation
With ActivePresentation.SlideMaster _
        .TextStyles(ppBodyStyle).Levels(1)
    With .Font
        .Name = "Arial"
        .Size = 80
    End With
    With .ParagraphFormat
        .LineRuleBefore = False
        .SpaceBefore = 14
        .Alignment = ppAlignCenter
    End With
End With

With ActivePresentation
    Do While Not EOF(iFileNum)
        Line Input #iFileNum, sText
        Set oSl = .Slides.Add(.Slides.Count + 1, ppLayoutTitleOnly)
        With oSl
            .Shapes.Title.TextFrame.TextRange.Text = sText
        End With
    Loop
End With

Set oSl = Nothing
Close iFileNum

End Sub

I've put the centering Sub in various places but it never centers for me.

Should I be using a different slide layout, say "Title" instead of "Title 
Only"?

Any help would be appreciated.

-- 
Teaching others to help themselves