Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Posts
    35

    Unhappy Unanswered: Import from excel

    Hi everybody!!!

    I hope somebody can help me.

    I want to import a spreadsheet from a excel file. I am going to use: DoCmd.TransferSpreadsheet acImport... but before do that I want to be sure that the spreadsheet exists. I was thinking to use Dir( , ) but I don’t know how to use it with a spreadsheet.

    Can somebody help me with this?, Do you have another idea?

    Thank you
    MARGA

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Lightbulb

    Try the following:
    PHP Code:
      If UCase(Dir("C:\yourData\yourSheet.Xls"))= Ucase("yourSheet.Xls"Then
         
    Do your Import ......
      Else
        
    MsgBox "File was not found...."
      
    End IF 

  3. #3
    Join Date
    Apr 2004
    Posts
    35

    Unhappy

    Hi,

    Thank you for your help, but it didn't work.
    Did you mean???

    Dir("C:\filename\sheetname.xls")

    If it's like that, it didn't work.

    Do you know what happen, do you have another idea??

    Thank you for your help
    MARGA

  4. #4
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    you may have to do "\\" because "\n" means return for example.

  5. #5
    Join Date
    Apr 2004
    Posts
    35
    I already did that, and it didn't work.

    MARGA

  6. #6
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Quote Originally Posted by margaquinon
    Hi,

    Thank you for your help, but it didn't work.
    Did you mean???

    Dir("C:\filename\sheetname.xls")

    If it's like that, it didn't work.

    Do you know what happen, do you have another idea??

    Thank you for your help
    Did you put you .Xls in a subdirectory called filename?

    If you put your sheetName.Xls under, say the root of C: then try that:

    PHP Code:
    If UCase(Dir("C:\SheetName.Xls"))= Ucase("SheetName.Xls"Then
         
    Do your Import ......
      Else
        
    MsgBox "File was not found...."
      
    End IF 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •