Results 1 to 9 of 9

Thread: VBA - 'Sorry, we couldn't find'
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2009
    Posts
    44
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA - 'Sorry, we couldn't find'

    I need to run a macro on a workbook that cannot be saved as a macro-enabled workbook, so I have set up a second workbook (Refresh.xlsm) and added the code below to open the workbook if want to run the macro in (Project check.xlsx) and then run a macro from Refresh.xlsm.

    This code opens the workbook, but fails to run the macro. I get an error message 'Sorry, we couldn't find Refresh.xlsm'. Is it possible it was moved, renamed or deleted?'

    Given both files are in the same folder, and the first one opens fine, something must be amiss, any ideas?

    Code:
    Sub openBk()
    
    Workbooks.Open "C:\Users\Stuart MacDonald\OneDrive - Cles\Order book\Project check.xlsx"
    Application.Run "C:\Users\Stuart MacDonald\OneDrive - Cles\Order book\Refresh.xlsm'!Refresh"
    
    
    End Sub
    Last edited by stuartmacdonald; Nov 16th, 2018 at 05:16 PM.

  2. #2
    Board Regular
    Join Date
    Nov 2013
    Location
    Hampshire, UK
    Posts
    521
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)

    Default Re: VBA - 'Sorry, we couldn't find'

    Not sure about the error but;

    Can you not store the macro in the PERSONAL.XLSB workbook and then even create your own ribbon?
    Seems far easier than opening multiple workbooks.

    - Posting guidelines, forum rules and terms of use

    - Try searching for your answer first, see how

    - Read the FAQs

    - List of BB codes

  3. #3
    MrExcel MVP shg's Avatar
    Join Date
    May 2008
    Location
    The Great State of Texas
    Posts
    21,610
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    14 Thread(s)

    Default Re: VBA - 'Sorry, we couldn't find'

    How about ...
    Code:
    Application.Run "Refresh.xlsm'!Refresh"

  4. #4
    New Member
    Join Date
    May 2009
    Posts
    44
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA - 'Sorry, we couldn't find'

    Same error message

  5. #5
    MrExcel MVP shg's Avatar
    Join Date
    May 2008
    Location
    The Great State of Texas
    Posts
    21,610
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    14 Thread(s)

    Default Re: VBA - 'Sorry, we couldn't find'

    Please confirm:

    o The procedure doesn't take any arguments

    o It's in a standard code module (not a sheet module or ThisWorkbook)

  6. #6
    New Member
    Join Date
    May 2009
    Posts
    44
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA - 'Sorry, we couldn't find'

    Dear shg


    Im not sure what you mean by the procedure doesn't take any arguments

    This macro is in module 1

    Code:
    Sub openBk()
    
    Workbooks.Open "C:\Users\Stuart MacDonald\OneDrive - Cles\Order book\Project check.xlsx"
    Application.Run "C:\Users\Stuart MacDonald\OneDrive - Cles\Order book\Refresh.xlsm'!Refresh"
    
    
    End Sub


    While the Refresh macro is in module 3

    Code:
    Sub Refresh()'
    ' Refresh Macro
    '
    
    
    '
        Windows("Project check.xlsx").Activate
        Cells.Select
        Range("CLES_project_check[[#Headers],[Contract_No&Desc]]").Activate
        Selection.ClearContents
        ActiveWorkbook.Connections("Query - CLES_project_check").Refresh
        With ActiveSheet.ListObjects.Add(SourceType:=4, Source:=ActiveWorkbook. _
            Connections("Query - CLES_project_check"), Destination:=Range("$A$8")). _
            TableObject
            .RowNumbers = False
            .PreserveFormatting = True
            .RefreshStyle = 1
            .AdjustColumnWidth = True
            .ListObject.DisplayName = "CLES_project_check"
            .Refresh
        End With
        ActiveWorkbook.Save
        ActiveWindow.Close
    End Sub



  7. #7
    New Member
    Join Date
    May 2009
    Posts
    44
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA - 'Sorry, we couldn't find'

    I need these macros to be used by anyone using the workbook, so dont think storing in the PERSONAL.XLSB workbook is the way I need to go...

  8. #8
    Board Regular
    Join Date
    Jan 2014
    Location
    Dublin, Ireland
    Posts
    1,421
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA - 'Sorry, we couldn't find'

    if Refresh.xlsm is already open it should be

    Code:
    Sub openBk()
    
    
    Workbooks.Open "C:\Users\Stuart MacDonald\OneDrive - Cles\Order book\Project check.xlsx"
    Application.Run "Refresh.xlsm!Refresh"
    
    
    
    
    End Sub
    Last edited by BarryL; Nov 20th, 2018 at 07:01 AM.
    Learn something new everyday.

    be sure to use code tags

    Code:
    [ code ]
    [ / code ]
    ' no spaces

  9. #9
    New Member
    Join Date
    May 2009
    Posts
    44
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA - 'Sorry, we couldn't find'

    There was an erroneous ' in my code referencing the location... took it out, and fixed... but its still not working, but different issue now...

    https://www.mrexcel.com/forum/excel-...ml#post5180041

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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