Problems w\ Macro to connect Worksheet object to TextBox

  • Thread starter Thread starter iamito
  • Start date Start date
I

iamito

Hi

I want to create an interactive slide in Powerpoint that connects a
worksheet object to a Textbox, but I can't seem to do it.

This is what I've written so far:

Private Sub TextBox1_Change()

Dim num As Double

num = TextBox1.Value

If IsNumeric(num) Then
Excel.Application.Activate.Sheet(1).Range("C8").Value = num
Else
MsgBox ("Please enter numbers only")
End If


End Sub



Any help would be greatly appreciated.

Miguel
 
Miguel,

Try this instead:

Private Sub Test()

Dim num As Double

' You need to set a reference to the MS Excel object library
' using Tools, References:
Dim oSheet As Excel.Worksheet
' or do this instead:
' Dim oSheet as Object

num = 22

' change the following to the correct slide number and
' object name.
' Watch out for linebreak ... this should all be one line:
Set oSheet = ActivePresentation.Slides(4).Shapes("Object
5").OLEFormat.Object.Worksheets(1)


With oSheet
.Range("C8").Value = num
End With

End Sub
 
Back
Top