word lists inported from a macro

M

McDoughall

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

John Wilson

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
 
M

McDoughall

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
 

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