Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto run macro and inserting text from txt file into powerpoint

Status
Not open for further replies.

alaou

MIS
Apr 19, 2011
4
Hello all

I'm new , so i need your help.

My first goal i want to achieve is how macro run automatically with presentation opening.

Second, i want to insert text in slide 6,in ONE textbox from many *.txt files.

Thanks in advance.
 
1) Use either the PresentationOpen or the AfterPresentationOpen event of your Application object.
2) What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Basically i have a presentation with many slides.
In some slides i put pictures and in the others i put just text.

I manage to insert pictures with .AddPicture

but so far i haven't find a way to insert text from an external txt file...
 
Anyone???!!!!

Please guys. it's very important for me
 


2) What have you tried so far and where in your code are you stuck
CODE???

Where is your code?

EXACTLY where are you stucke IN YOUR CODE???

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Powerpoint does not have an autorun capability for presentations (unlike other office applications which will allow you to autorun code when a document opens); it only works in a PowerPoint add-in, which must be loaded in the application. You have to initiate the macro manually (through a button, rollover, or selecting from the Macros menu)

I have heard that there might be a way to make this work in PPT 2007, but IIRC, it requires editing the presentation's XML.
 
Sub ÌáêñïåíôïëÞ4()
'
'
'
Dim FileName As String
Dim FileNum As Integer
Dim InputBuffer As String

ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizontal, 93.5, 88.625, 544.375, 28.875).Select
ActiveWindow.Selection.ShapeRange.TextFrame.WordWrap = msoTrue
With ActiveWindow.Selection.TextRange.ParagraphFormat
.LineRuleWithin = msoTrue
.SpaceWithin = 1
.LineRuleBefore = msoTrue
.SpaceBefore = 0.5
.LineRuleAfter = msoTrue
.SpaceAfter = 0
End With
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange

FileName = "C:\text1.txt"

FileNum = FreeFile
If Dir$(FileName) <> "" Then


Open FileName For Input As FileNum

While Not EOF(FileNum)
Input #FileNum, InputBuffer




.Text = InputBuffer
Wend
Close FileNum

End If
With .Font
.Name = "Arial"
.Size = 18
.Bold = msoFalse
.Italic = msoFalse
.Underline = msoFalse
.Shadow = msoFalse
.Emboss = msoFalse
.BaselineOffset = 0
.AutoRotateNumbers = msoFalse
.Color.SchemeColor = ppForeground
End With

End With






End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top