VBA - 'Sorry, we couldn't find'

stuartmacdonald

New Member
Joined
May 26, 2009
Messages
48
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:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
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.
 
Upvote 0
How about ...
Code:
Application.Run "Refresh.xlsm'!Refresh"
 
Upvote 0
Please confirm:

o The procedure doesn't take any arguments

o It's in a standard code module (not a sheet module or ThisWorkbook)
 
Upvote 0
Dear shg


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

This macro is in module 1

Code:
[/COLOR]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


[COLOR=#333333]

While the Refresh macro is in module 3

Code:
[/COLOR]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


[COLOR=#333333]

 
Upvote 0
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...
 
Upvote 0
if Refresh.xlsm is already open it should be

Rich (BB 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:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top