Last active
August 29, 2015 14:07
-
-
Save nemupm/bef6c57157eb172445eb to your computer and use it in GitHub Desktop.
insert_shapes_into_pptx_loading_txtfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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