Results 1 to 6 of 6

Thread: Simply open excel

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    Simply open excel

    I just installed Visual Studio 2010
    I want ONLY write code in order to use data stored in a excel file.
    I just want to create a Form , open an excel file and browse it.
    Should I create a pecial project ? Should In install something more than just Visual studio ? Should I declare or add any library ? what are the code instructions to be used ?

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

    Re: Simply open excel

    see the tutorial in the faq thread at the top of this forum

    yes you should start a new project, you would need a reference to excel, unless you use late binding
    as long as excel is already installed you should not need to install any additionals
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    Re: Simply open excel

    sorry, i didn't understand ... I started a new project, put a button in Form1 ans wrote some code on clicking the buutton
    i used the code Workbooks.open("myexcelfile.xls") and i get error od workbooks. the system asks me to create the Workbooks class .....

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

    Re: Simply open excel

    yes, you have to create an object of excel first, then the workbooks collection is a property of that object, on which you can use the open or add methods

    did you look at the tutorial?
    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    Re: Simply open excel

    I didn't look at the tutorial, because I don't know which tutorial ...... You're so kind and I'm grateful, would you like to lead me with details ?

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

    Re: Simply open excel

    i only use vb6 so i can not help with visual studio 2010, apart from basics, you need to research more, or wait till someone familiar with .net syntax reads the post
    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