Results 1 to 7 of 7
  1. #1
    Star Lounger
    Join Date
    Apr 2003
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Excel file in the form (A97)

    I have question regarding on how to open the excel file using the access form. Right now, im using open dialog file->search my excel files frm D:My documentsFolder name*.*.xls. <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15> The problem is when i click on 'OK' button it does not open the file. Where could it be wrong? Pls help.. <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

    Looking forward for your reply.

    tks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Excel file in the form (A97)

    What is your purpose? Do you want to start Excel with the specified workbook, or do you want to retrieve data from the workbook into Access?

    And by "open dialog file", do you mean File | Open..., or do you use the Common Dialog ActiveX control, or ...?

  3. #3
    Star Lounger
    Join Date
    Apr 2003
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Excel file in the form (A97)

    Thanks for your reply.
    1) when i in use of Access, i do not want to close n exit database. I want to retrieve data using the form in same database.

    2) open dialog file means i have created a dialog file to open a file directory and select files which i want to open....(i do not use common dialog activeX control. Its form design custom to create a dialog)

    regards
    nuglorious

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Excel file in the form (A97)

    Can you post the code you are using to open the Excel workbook?

  5. #5
    Star Lounger
    Join Date
    Apr 2003
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Excel file in the form (A97)

    Private Sub ok_Click()
    Dim retval

    retval = Shell("C:Program FilesMicrosoft OfficeOfficeEXCEL.EXE D:my documentsfeederratetbl*.*.xls", 1)

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Open Excel file in the form (A97)

    In the first place, the path contains spaces, so it should be enclosed in quotes within the string. To include quotes within a string, they must be doubled, otherwise they will terminate the string.

    In the second place, when you start Excel with Shell, you can open a specific file, not a wildcard. So if Data2003.xls is a workbook, this should work:

    Retval = Shell("C:Program FilesMicrosoft OfficeOfficeEXCEL.EXE ""D:my documentsfeederratetblData2003.xls""", 1)

    If you want to open the Open File dialog, or start a file search, you must either open an Excel workbook that automatically runs a macro to do so, or control Excel from within Access. The latter is called Automation; it requires that you are comfortable with both Access VBA and Excel VBA. Access moderator <!profile=WendellB>WendellB<!/profile> has a tutorial on Automation on his website (link in his profile, look for Support > Tutorials).

  7. #7
    Star Lounger
    Join Date
    Apr 2003
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open Excel file in the form (A97)

    Hi HansV

    Thks for your prompt reply.

    The problem has been solved and it works great. Thks to you again <img src=/S/bananas.gif border=0 alt=bananas width=33 height=35>

    The open file dialog which you have mentioned here, its a great informations. I will surely learn and use it for my this project.

    Thanks n regards

    nuglorious <img src=/S/crossfingers.gif border=0 alt=crossfingers width=17 height=16> <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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