S
stebbix
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
----
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
----