+ Reply to Thread
Results 1 to 4 of 4

Code not opening the workbook due to unknown reasons

  1. #1
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Code not opening the workbook due to unknown reasons

    I have the following piece of code, that is supposed to open one or another file depending on the value in a cell. The problem is that it returns an error saying that the file may have been moved or deleted. The file name is partial, but the error returns the full name of the workbook. Meaning that it finds it in the folder, as I can clearly see it. Any ideas why? Error line marked.
    Please Login or Register  to view this content.
    Click the * to say thanks.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,769

    Re: Code not opening the workbook due to unknown reasons

    Dir only returns the name of the file, you need to add the path to the workbook.Open along with the filename.

  3. #3
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Code not opening the workbook due to unknown reasons

    So stupid and so obvious. I removed the directory from the syntax without paying attention. Thank you for pointing it out.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,769

    Re: Code not opening the workbook due to unknown reasons

    You're welcome & thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VLOOKUP #N/A Error for unknown reasons
    By Anuru in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-09-2019, 06:58 AM
  2. [SOLVED] Macros taking too much time to complete due to unknown reasons to me
    By PaulM100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2018, 09:32 AM
  3. "Code Execution Has Been Interrupted" - Unknown reasons
    By Bearz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2016, 05:42 PM
  4. [SOLVED] Can I use vba code to get a value of a cell in other workbook without opening the workbook
    By mrkhchan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2015, 11:50 PM
  5. [SOLVED] Opening new workbook and pasting values into current workbook - code issues
    By Stew1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-15-2014, 07:56 AM
  6. Excel 2007 : Colors changing for unknown reasons
    By Apocolyptus in forum Excel General
    Replies: 0
    Last Post: 04-14-2011, 08:55 AM
  7. [SOLVED] run code on opening workbook and apply code to certain sheets
    By Jane in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-08-2005, 05:05 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1