• Open Excel file in the form (A97)

    Author
    Topic
    #391294

    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. bummer The problem is when i click on ‘OK’ button it does not open the file. Where could it be wrong? Pls help.. dizzy

    Looking forward for your reply.

    tks

    Viewing 0 reply threads
    Author
    Replies
    • #698522

      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 …?

      • #698784

        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

        • #698815

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

          • #699751

            Private Sub ok_Click()
            Dim retval

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

            • #699766

              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 WendellB has a tutorial on Automation on his website (link in his profile, look for Support > Tutorials).

            • #700381

              Hi HansV

              Thks for your prompt reply.

              The problem has been solved and it works great. Thks to you again bananas

              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 crossfingers cheers

    Viewing 0 reply threads
    Reply To: Open Excel file in the form (A97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: