Open an Excel file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gut7ue
    New Member
    • Feb 2010
    • 1

    Open an Excel file.

    Hi,

    I write VBA codes every now and then and am quite comfortable with it. However, I am failing to do something very very basic and totally perplexed at what am I doing wrong.

    I am trying to open a file from a code. I have written a very simple one line Sub for it, which goes like:

    Sub SendTradeReques t
    Workbooks.Open "C:\Users\Preci sion Engg Corp\Desktop\Te st.xlsx"
    End Sub

    The workbook as above, does exist. The proof is that when I copy paste the above name in Run command under Start menu, it opens the file. But everytime I run the code from Excel, I get an error message:

    -------
    Run-time error '1004':

    'C:\Users\Preci sion Engg Corp\Desktop\Te st.xlsx' could not be found. Check the spelling, and verify the file location..... and all that jazz.
    -------

    What am I doing wrong? Can someone help please, it's driving me nuts?

    Thanks,
    Polo
Working...