Results 1 to 4 of 4

Thread: HELP! OLE Microsoft Excel Chart

  1. #1

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256

    HELP! OLE Microsoft Excel Chart

    I have a textBox on a user form, with an embedded OLE Microsoft Chart. What I need to do is when the user inputs a value in the text box, write it to Sheet1 of the worksheet using the text1_change function. but, i don't know the code to write that value to that embedded worksheet. Thanks,

    JeFF

  2. #2
    Addicted Member
    Join Date
    Mar 2001
    Posts
    130
    Try something like this:
    Code:
    Option Explicit
    
    Const OLE_CREATE_EMBED = 0
    
    Private Sub Command1_Click()
    
    Dim objChart As Object
    
    OLE1.Class = "Excel.Chart.8"
    OLE1.Action = OLE_CREATE_EMBED
    
    Set objChart = OLE1.object
    
    objChart.Worksheets("Sheet1").Cells(4, 3).Value = Text1.Text
    
    End Sub
    This will assign the text in textbox Text1 to the cell at row 4, column 3 when button Command1 is pressed.

    -mort

  3. #3
    Addicted Member
    Join Date
    Mar 2001
    Posts
    130

  4. #4

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256
    thanks so much! that works perfectly. I have been trying to do that for a while now.

    JEFF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width