Results 1 to 13 of 13

Thread: EXCEL big problem 4 a newb!!!

  1. #1

    Thread Starter
    Addicted Member Appaq's Avatar
    Join Date
    Jul 2002
    Location
    Buzau | RO
    Posts
    179

    Red face EXCEL big problem 4 a newb!!!

    Please help me to open the excel file, to read it and to list into the combo boxes... please... se the sa,ple... i`ve try it already to but i cant do it,,, i dont know how... from where to start and where to stop.. please help me!
    See the sample!
    Attached Files Attached Files
    skin

  2. #2
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611
    2 thing you need 2 know :
    1 how to use excel in VB
    2 macro recorden in excel.

    The first is not difficult at all. Can be found on this forum easily, but here is a start:
    First make a reference to:
    Microsoft Excel 8.0 Object Liberary

    then you can do this:
    VB Code:
    1. Private m_objExcel As Excel.Application
    2. Dim m_Sheets As Excel.Sheets
    3.  
    4. Private Function CreateExcelObject() As Boolean
    5.  
    6.     On Error GoTo ErrorHndl
    7.    
    8.     If (TypeName(m_objExcel) <> "Application") Then
    9.         Set m_objExcel = CreateObject("excel.Application")
    10.     End If
    11.  
    12.    
    13.     CreateExcelObject = True
    14.     Exit Function
    15.    
    16. ErrorHndl:
    17.     CreateExcelObject = False
    18.  
    19. End Function

    Second the macro recorder, this can be used to record stuff you do, then you can see the code. If you past that code into it can run, after you called the createexcelobject.
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  3. #3

    Thread Starter
    Addicted Member Appaq's Avatar
    Join Date
    Jul 2002
    Location
    Buzau | RO
    Posts
    179
    please help me with this sample...
    skin

  4. #4
    Hyperactive Member Libero's Avatar
    Join Date
    Jun 2000
    Location
    Swedish viking
    Posts
    460
    Here ya go! I have also included code to terminate the excel process,because many people got probs with that.
    Attached Files Attached Files

  5. #5

    Thread Starter
    Addicted Member Appaq's Avatar
    Join Date
    Jul 2002
    Location
    Buzau | RO
    Posts
    179
    Thanks libero!
    The sample is a fine begining but... i dont know how to put the sheet "Autor 2" into the combo 2... in this sample is not specified the shhet number... and the labels years...
    Anyone can help me more... ?!? Please....
    skin

  6. #6

    Thread Starter
    Addicted Member Appaq's Avatar
    Join Date
    Jul 2002
    Location
    Buzau | RO
    Posts
    179

    Unhappy

    no one can help me to resolve this problem ?! please... who knows... please help me...
    skin

  7. #7
    Hyperactive Member Libero's Avatar
    Join Date
    Jun 2000
    Location
    Swedish viking
    Posts
    460

    Red face

    I will have a look at that when i return to work on Tuesday ( if you havent resolved it until then ), cause i havent installed VB on my home pc for the moment.

  8. #8

    Thread Starter
    Addicted Member Appaq's Avatar
    Join Date
    Jul 2002
    Location
    Buzau | RO
    Posts
    179
    Thanks libero... i`ll wait your post... thanks again!
    skin

  9. #9

    Thread Starter
    Addicted Member Appaq's Avatar
    Join Date
    Jul 2002
    Location
    Buzau | RO
    Posts
    179
    Libero are u here ?! Please...
    skin

  10. #10
    Hyperactive Member Libero's Avatar
    Join Date
    Jun 2000
    Location
    Swedish viking
    Posts
    460

    Cool

    Working on it right now..... Sorry, i was on vacation yesterday..

  11. #11
    Hyperactive Member Libero's Avatar
    Join Date
    Jun 2000
    Location
    Swedish viking
    Posts
    460
    Here we go... You may have to clean up the code a bit, because i was in a bit of hurry. But its working on my PC now.. Good luck!!
    Attached Files Attached Files

  12. #12

    Thread Starter
    Addicted Member Appaq's Avatar
    Join Date
    Jul 2002
    Location
    Buzau | RO
    Posts
    179

    Wink Thanks Libero

    Thanks for your help man. Thanks again! I wish i cold give u a beer!
    skin

  13. #13
    Hyperactive Member Libero's Avatar
    Join Date
    Jun 2000
    Location
    Swedish viking
    Posts
    460
    You can PM me the beer. Only glad to help..

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