How to declare a variable as an excel worksheet in vba

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • almaroc
    New Member
    • Nov 2011
    • 48

    How to declare a variable as an excel worksheet in vba

    i am using access 2007 and i am trying to read data directly from a spreadsheet. i am running into this error User defined object not defined. i am declaring the variable as follow
    dim Mywb as workbook
    dim Myws as worksheet
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Assuming you've included the reference to the Excel library, you need to qualify it using Excel.. Meaning you need to use Excel.Workbook

    Comment

    • almaroc
      New Member
      • Nov 2011
      • 48

      #3
      Thanks Rabbit that took care of it. i really appreciate it.

      Comment

      Working...