Skip to content

Instantly share code, notes, and snippets.

@nemupm
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save nemupm/bef6c57157eb172445eb to your computer and use it in GitHub Desktop.

Select an option

Save nemupm/bef6c57157eb172445eb to your computer and use it in GitHub Desktop.
insert_shapes_into_pptx_loading_txtfile
Sub insert_terms()
'make object
Dim txt As Object
Set txt = CreateObject("ADODB.Stream")
'set object parameter
txt.Type = adTypeText
txt.Charset = "UTF-8"
txt.LineSeparator = 10 'LF
'make instance
txt.Open
'load text file
txt.LoadFromFile("input.txt")
With ActivePresentation
i = 0
Do While Not txt.EOS
i = i + 1
'insert shape into 1st slide of active presentation
Set shape = .Slides(1).Shapes.AddShape( _
Type:=msoShapeRectangle, _
Left:=i, _
Top:=i, _
Width:=200, _
Height:=50)
With shape
.TextFrame.TextRange = txt.ReadText(adReadLine)
.TextEffect.FontSize = 20
End With
Loop
End With
txt.Close
Set txt = Nothing
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment