+ Reply to Thread
Results 1 to 7 of 7

Workbooks.Open(filename) "Sorry we couldn't find the file ..."

  1. #1
    Forum Contributor
    Join Date
    08-22-2017
    Location
    USA
    MS-Off Ver
    2016 WINDOWS and MAC
    Posts
    294

    Workbooks.Open(filename) "Sorry we couldn't find the file ..."

    Hi friends,


    High chance this is unsolvable because what i'll show you makes absolutely 0 sense...


    The code below is using the Excel Object lib within MS Access. Purpose is create a query, export that query to Excel using built-in Access "DoCMD.TransferSpreadsheet" then edit some of the content of that spreadsheet.


    Please Login or Register  to view this content.

    The pathandfilename var is a string that is retrieved from msofiledialogfilepicker. It works fine. The interesting thing is that when I REPLACE an existing file, all is well. However, when I am CREATING a new file, the Workbook.Open event can't find the file. Which again, makes no theoretical sense because..

    The docmd does in fact create the spreadsheet in the exact location. I can put a codebreak right after and it does exactly what it intended. Running msgbox on the filepath (above) returns the correct filepath.

    So.. something else is up.

    Ideas?

    Thanks

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Workbooks.Open(filename) "Sorry we couldn't find the file ..."

    Hi there,

    Definitely a head-scratcher!

    This isn't a solution, but just might assist in the diagnosis . . . . does

    Please Login or Register  to view this content.
    display the name of the newly-created file?


    Regards,

    Greg M

  3. #3
    Forum Contributor
    Join Date
    08-22-2017
    Location
    USA
    MS-Off Ver
    2016 WINDOWS and MAC
    Posts
    294

    Re: Workbooks.Open(filename) "Sorry we couldn't find the file ..."

    Greg!

    Thanks for your reply... I ran your code...

    Surprisingly, the msgbox returns nothing!! What does this mean?

    Thanks!

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Workbooks.Open(filename) "Sorry we couldn't find the file ..."

    Hi again,

    Thanks for your reply.

    It suggests that the newly-created file "hasn't yet made it into the filing system".

    As a further part of the diagnosis, try:

    Please Login or Register  to view this content.
    to see if allowing the system to "take time out" to update the filing system makes a difference.


    I wonder if this will help - please let me know how you get on.

    Regards,

    Greg M


    P. S. To the purists out there, apologies for the less than strictly accurate use of the above technical terms (enclosed in quotes)

  5. #5
    Forum Contributor
    Join Date
    08-22-2017
    Location
    USA
    MS-Off Ver
    2016 WINDOWS and MAC
    Posts
    294

    Re: Workbooks.Open(filename) "Sorry we couldn't find the file ..."

    Greg,


    Thanks for your time and help with this...

    More bad news... The routine just hangs forever in loop... (though I haven't waited for more than 1 minute)... See code below.

    Please Login or Register  to view this content.
    Any ideas?

    EDIT: Greg, you should be reminded that I can in fact open the file manually in windows with no problems.
    Last edited by ironfelix717; 02-02-2019 at 10:14 AM.

  6. #6
    Forum Contributor
    Join Date
    08-22-2017
    Location
    USA
    MS-Off Ver
    2016 WINDOWS and MAC
    Posts
    294

    Re: Workbooks.Open(filename) "Sorry we couldn't find the file ..."

    UPDATE:

    Please note this question has been asked here also:

    http://www.accessforums.net/showthre...058#post421058



    This question has been solved and was due to the pathandfilename variable not including the extension of the spreadsheet when establishing a new file to save. Thanks Greg for your help.
    Last edited by ironfelix717; 02-03-2019 at 11:17 AM.

  7. #7
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,467

    Re: Workbooks.Open(filename) "Sorry we couldn't find the file ..."

    Hi again,

    Thanks for that very useful feedback.

    Glad to hear that things are working correctly for you now.

    Regards,

    Greg M

+ 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. [SOLVED] Workbooks.Open method and runtime error 1004 - "file couldn't be found".
    By PHBlaz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-28-2014, 02:10 PM
  2. Replies: 1
    Last Post: 11-12-2013, 09:23 AM
  3. reference the file set by the VBA code "Set wb = Workbooks.Open(sWb)"
    By ggremel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-26-2011, 11:49 PM
  4. how to close a file opened with "Workbooks.Open Filename:=sWb"
    By ggremel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2011, 10:37 PM
  5. Wildcard or "Begins With" in a Workbooks.open filename directory?
    By Fazered in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-24-2007, 07:17 AM
  6. Replies: 2
    Last Post: 07-17-2006, 06:55 PM
  7. couldn't find "solver" in Excel 2007
    By charles in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-10-2006, 08:24 PM
  8. Replies: 1
    Last Post: 12-21-2005, 12:10 PM

Tags for this Thread

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