Results 1 to 9 of 9

Thread: Inserted Excel Worksheet

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Posts
    157

    Inserted Excel Worksheet

    Dear Anyone

    I've inserted from Insertable Objects Microsoft Excel Worksheet
    What is the procedure to start this worksheet running

    Why is that the gridlines are shown on the form of Excel Worksheet
    and the Worksheet itself is not displayed when dragged from toolbox to
    the working enviornment of the form ?

    How do i get the data on Cell (1, 1) from a text box

    Thanks
    Sam F

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Inserted Excel Worksheet

    I don't understand what you mean by "start the work sheet running."

    Excel really doesn't start or stop, it just is.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Posts
    157

    Re: Inserted Excel Worksheet

    Hi Hack
    What i mean is to open or display the worksheet

    Regards

    SamF

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Inserted Excel Worksheet

    I've inserted from Insertable Objects Microsoft Excel Worksheet
    I'm not sure what you are referring to here, is this something which is provided in the VB Editor (thus VBA) within an Office application? I can't find it in VB6.

    Unfortunately without knowing what quite you are doing so far, we can't really help with the next steps.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Posts
    157

    Re: Inserted Excel Worksheet

    Dear Si The geek

    Go to the menu PROJECTS
    click on Components
    and select Insertable Objects
    and Tick on Microsoft Excel Worksheet

    Then in the ToolBox Icon of Excel SHEET will display.
    This Sheet Icon i drag and place it to the Form

    So i've have a text box whre i want to enter the data and the same data
    should be displayed in the Excel Sheet Cell (2,1)

    Regards
    Sam F

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Posts
    157

    Re: Inserted Excel Worksheet

    Any one

    Private Sub Sheet1_Validate(Cancel As Boolean)
    'What do i write in


    End Sub

    Private Sub Sheet1_GotFocus()
    'What do i write in


    End Sub



    Basically when the Form is loaded
    This Excel Worksheet should be opened
    Why Do i have to click on Sheet1 twice
    Why it cannot open on the form by itself.


    Regards

    SamF

  7. #7
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Inserted Excel Worksheet

    I had a bit of a play around, but I can't find any way to actually reference the sheet (or workbook etc) with that method.

    What you could do instead (if you want to keep it inside your form) is use the OLE control, set the Class to Excel.Sheet , and then use code like this:
    Code:
    'OLE1.object is equivalent to a WorkBook
      OLE1.object.sheets(1).Cells(2, 1) = "hello"
    ..or if you want to do multiple things with it, like this:
    Code:
      With OLE1.object.sheets(1)
         .Cells(2, 1) = "hello"
         .Cells(2, 2) = "more text"
    ...
      End With
    If you are willing to have Excel run as a separate application to your program, see the Excel Tutorial link in my signature.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Posts
    157

    Re: Inserted Excel Worksheet

    How do i load these OLE contorl ?

    Regards
    SamF

  9. #9
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Inserted Excel Worksheet

    ole control is in the standard controls toolbox
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

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