+ Reply to Thread
Results 1 to 4 of 4

error 1004 using variable as a filename in opentext

Hybrid View

  1. #1
    Registered User
    Join Date
    08-13-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: error 1004 using variable as a filename in opentext

    Quote Originally Posted by Paul View Post
    Just checking, but does your fPath end with "\"? If not, then you might be trying to open something like:

    "F:\Data\AllPMapTogether\AllExportTopZeroTable.xlsx"

    instead of

    "F:\Data\AllPMapTogether\AllExport\TopZeroTable.xlsx"
    Yes, my path has the quote included with it. I have also tried to omit the "\" and add it by:

    Workbooks.OpenText Filename:=fpath & "\" & fname,...
    but neither solved the error.

  2. #2
    Registered User
    Join Date
    08-13-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: error 1004 using variable as a filename in opentext

    As I have troubleshot the problem, it appears to be an issue with reading a value into a program from a txt or xlsx file. The Workbook.OpenText will not work when I read the value using Cells() or Range(), and then put that variable in as the filename.

    When I hardcode the filename or declare it in the code, the Workbook.OpenText will work.

    Any thoughts as to why it won't read in the value from a txt/xlsx file? Any ideas how to solve it?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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