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