What I need to do is really simple.. in a powerpoint slide I neeed to be able
to read from txt file with a press of a button and the text appears in a
textbox with scrollbars..
this is the code that iam currently working with.. and it's not working!..
can anybody help me.?
----
Private Sub CommandButton1_Click()
Dim FileNum As Integer
Dim FileName As String
Dim InputBuffer As String
Dim oTextBox As Shape
Dim strText As String
FileName = "C:\atvika_skraning.txt"
FileNum = FreeFile
' A little error checking
If Dir$(FileName) <> "" Then ' the file exists, it's safe to continue
Open FileName For Input As FileNum
While Not EOF(FileNum)
Input #FileNum, InputBuffer
' Do whatever you need to with the contents of InputBuffer
Set oTextBox =
ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(Left:=114#, _
Top:=48#, _
Width:=522#, _
Height:=450#, _
ClassName:="Forms.TextBox.1", _
Link:=msoFalse)
With oTextBox.OLEFormat.Object
.MultiLine = True
.WordWrap = True
.ScrollBars = fmScrollBarsVertical
.Text = InputBuffer
Wend
Close FileNum
Else
' the file isn't there. Don't try to open it.
End If
End Sub
----
stebbix - 30 Jul 2007 10:36 GMT
> What I need to do is really simple.. in a powerpoint slide I neeed to be able
> to read from txt file with a press of a button and the text appears in a
[quoted text clipped - 44 lines]
> End Sub
> ----
forgot to mention.. the error is something like.. wend cannot come before
while..
John Wilson - 30 Jul 2007 11:20 GMT
You're missing an "End With"
With oTextBox.OLEFormat.Object
.MultiLine = True
.WordWrap = True
.ScrollBars = fmScrollBarsVertical
.Text = strMessage
End With 'here
Also I think your code will add a new box for each line of the code so you
might want to use something like
While Not EOF(FileNum)
Input #FileNum, InputBuffer
strMessage = strMessage & InputBuffer
Wend

Signature
Amazing PPT Hints, Tips and Tutorials-
http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk/ppttipshome.html
email john AT technologytrish.co.uk
> What I need to do is really simple.. in a powerpoint slide I neeed to be able
> to read from txt file with a press of a button and the text appears in a
[quoted text clipped - 44 lines]
> End Sub
> ----
max - 05 Sep 2007 20:52 GMT
http://www.ellenfinkelstein.com/powerpoint_tip_add_notes_during_presentation.html
maybe that will help to
max
> What I need to do is really simple.. in a powerpoint slide I neeed to be
> able
[quoted text clipped - 45 lines]
> End Sub
> ----