+ Reply to Thread
Results 1 to 6 of 6

Referencing closed workbook for cell value problem

  1. #1
    Registered User
    Join Date
    09-14-2017
    Location
    Orlando
    MS-Off Ver
    2013
    Posts
    14

    Referencing closed workbook for cell value problem

    Hello all,

    I'm working with the code below which works for the most part. I'm trying to reference a closed Excel file with a different extension of .gcode. I have validated that it works by creating test.gcode with a sheetname of test. I'm able to return the correct value of any cell I query.

    My problem is when I use a file name that is in our company naming format, I'm getting "Run-time error '13': Type Mismatch". By default the sheet name is the file name without the extension.

    Any idea why?

    Thanks!

    HTML Code: 
    Last edited by distantkitty; 09-14-2017 at 09:08 AM.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Referencing closed workbook for cell value problem

    Hi,

    Assuming there isn't actually an error value in that cell in the workbook, are you certain that the sheet name is correct? If it isn't, that would cause the Type Mismatch error.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Referencing closed workbook for cell value problem

    Please Login or Register  to view this content.
    Is this correct?

  4. #4
    Registered User
    Join Date
    09-14-2017
    Location
    Orlando
    MS-Off Ver
    2013
    Posts
    14

    Re: Referencing closed workbook for cell value problem

    that is correct. It is actually a .xlsm file which is saved as a .gcode so a piece of machinery can read it. I have tested to see if that file extension would work by making test.gcode and the macro was still able to read it. It only gets the error when I change the filename to our file format.

    Thanks!

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Referencing closed workbook for cell value problem

    I tested your code using those exact file and sheet names and it worked properly, hence my earlier question.

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Referencing closed workbook for cell value problem

    Perhaps an Error in the cell, so
    Please Login or Register  to view this content.

+ 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. Referencing closed workbook to get cell values
    By schadha006 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-12-2016, 05:30 AM
  2. Referencing cells in a closed workbook
    By ms418 in forum Excel General
    Replies: 6
    Last Post: 08-20-2015, 05:43 PM
  3. Referencing a closed workbook
    By blacktrek in forum Excel General
    Replies: 6
    Last Post: 05-25-2015, 02:52 PM
  4. Sumifs used referencing a closed workbook
    By kgallo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-20-2015, 06:57 PM
  5. [SOLVED] Trouble copying data from closed workbook into active workbook, referencing help
    By lepperga in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-20-2013, 01:48 PM
  6. [SOLVED] Referencing a closed workbook
    By RowanB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2012, 05:13 AM
  7. UDF referencing closed workbook not working
    By davegugg in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-25-2010, 09:17 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