Syntax For File Open

  • I know I asked something similar to this before, but I'm really having a hard time getting the syntax correct for this line of code.

    Workbooks.Open Filename:=F:MMD\Cells(Row, 1).Value) & ".xls"

    Could anyone offer a correction? Thanks.

    Where F:MMD is the path, and my filename comes from the cell referenced

  • Re: Syntax For File Open

    for my macro, I defined row as an integer. Thing is, when I use this code, and keep the files I am opening in a local folder, the macro works correctly:

    Workbooks.Open Filename:=(Cells(Row, 1).Value) & ".xls"


    But the suggestion you gave me doesn't. I'd really prefer what you suggested, because the files I ultimately intend to reference are on a shared hard drive, for which I need to give a path.

    Thanks for your prompt answer. Really appreciate the help.

  • Re: Syntax For File Open

    What error message do you get?

    It may be that the path is not correctly defined then. Open a workbook from the shared drive. Then in the immediate window (Ctrl G) of the VBE, enter
    Does what's returned match

    Depending on the answer, we can proceed to the next step.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!