+ Reply to Thread
Results 1 to 8 of 8

Code not recognising "myfilepath" workbook as Source

  1. #1
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Code not recognising "myfilepath" workbook as Source

    Field staff submit Excel sheets monthly that have to be added together in same cells in Master File.

    Code below allows User to select a "Field Staff" file from File Manager, defined as "myfilepath" (works perfectly).

    Selected file has data in Col B that has to be added to current value in matching cell in Master File.

    But code throws an "Invalid qualifier" when I tell it to find the "myfilepath" file and get the matching value

    Please Login or Register  to view this content.
    Suggestions, solutions and improvements accepted gratefully as ever

    Ochimus

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code not recognising "myfilepath" workbook as Source

    myFilepath is a string, not a workbook, and has no properties/sheets/etc.

    Try setting a reference to the workbook you are opening.
    If posting code please use code tags, see here.

  3. #3
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Re: Code not recognising "myfilepath" workbook as Source

    Norie,

    Many thanks for pointer,

    I set the workbook reference as "SourceFile", which got past that hurdle, but when I try to copy the cell from it, it stops with a "RunTime Error 438 (Object doesn't sjupport this property or method)"

    Please Login or Register  to view this content.
    Ochimus

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Code not recognising "myfilepath" workbook as Source

    You have to specify sheet in Sourcefile.
    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Re: Code not recognising "myfilepath" workbook as Source

    bakerman,

    Many thanks for correction.

    Code now runs, and "steps through" the cells in the Master File, but is not adding the values!

    The problem must be my defining "Source File".

    When I select the file from File Manager, I define that "Active Workbook" as "SourceFile"

    Presumably when I then select the Master File, it becomes the "Source File" because it's the active workbook?

    This should be straightforward, and it's annoying that I can't see the obvious.

    Ochimus

    Ochimus

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Code not recognising "myfilepath" workbook as Source

    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,397

    Re: Code not recognising "myfilepath" workbook as Source

    bakerman,

    Many thanks for the suggested correction. Had to tweak it slightly, but now have a working solution,.for which much thanks to both you and Norie.

    Please Login or Register  to view this content.
    Can now mark this as Solved.

    Ochimus
    Last edited by Ochimus; 05-20-2016 at 11:30 AM.

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Code not recognising "myfilepath" workbook as Source

    Too many Select - Activate to my taste, but if this works for you.

+ 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. Office 365 - excel recognising "<" and ">"??
    By Lou3494 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-13-2015, 01:23 PM
  2. Array formula not recognising "=Now()-365.25" as Date
    By Ochimus in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2015, 05:25 PM
  3. [SOLVED] Data validation "list" - "source" has too many characters
    By bee88 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-21-2015, 04:28 PM
  4. Replies: 8
    Last Post: 07-06-2014, 08:51 PM
  5. [SOLVED] MATCH recognising "A*" in progress tracking sheet?
    By paulstuartbullock in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-27-2013, 07:01 AM
  6. Need VBA Code to "VLOOKUP" but keep source cell Formatting
    By flyyboy84 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2012, 08:47 AM
  7. Replies: 1
    Last Post: 08-17-2006, 08:25 PM

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