Results 1 to 2 of 2

Thread: Excel Startup Problems

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    14

    Excel Startup Problems

    Dim exExcel As New Excel.Application
    Dim exSheet As Excel.Worksheet

    'Point A:
    exExcel.Workbooks.Open(strFilename)
    exSheet = exExcel.Worksheets(1)

    I get a "server has thrown an exception" at point A of the code. What's up with that! This little error has been driving me nuts all day!
    If you own a Compaq, throw it out. They are ghay!

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    VB Code:
    1. Dim exExcel As Excel.Application
    2. Dim exSheet As Excel.Worksheet
    3.  
    4. ' 1) Set the application after the dim declaration as
    5. ' this is more efficient.
    6. Set exExcel = new Excel.Application
    7.  
    8. ' 2) Do a check to see if the file exists...
    9. If not len(dir(strFilename)) = 0 then
    10.     exExcel.Workbooks.Open(strFilename)
    11.  
    12.     ' 3) Think I'm right in saying you'll need to set the worksheet
    13.     ' object up the 1st time you use it like this...
    14.     set exSheet = exExcel.Worksheets(1)

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

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