Hi Gurus,
I'm working on a dashboard of sorts and everything was working until I added this code which was to run and advanced filter, whilst prior to running the Adv Filter it checks to see if the file is open, and open if it is not.
"Call SupStatsLoad" Hilighted in Blue and error given at the begining of the referring from Sub
Basic References loaded Office Forms 14, Excel Forms 14, Forms 2.0 library, Ole Automation, and VBA.
Added Code located in Module and called from Workbook_Open
referred to Functions which is located in the Adv Filter Sheet
Any Help would be greatly appreciated,
Regards,
TheHagrid
I'm working on a dashboard of sorts and everything was working until I added this code which was to run and advanced filter, whilst prior to running the Adv Filter it checks to see if the file is open, and open if it is not.
"Call SupStatsLoad" Hilighted in Blue and error given at the begining of the referring from Sub
Basic References loaded Office Forms 14, Excel Forms 14, Forms 2.0 library, Ole Automation, and VBA.
Added Code located in Module and called from Workbook_Open
Code:
Call SupStatsLoad(SupMax)
referred to Functions which is located in the Adv Filter Sheet
Code:
Public Function SupStatsLoad(Max As Variant)
'Test if SupWB is open
SupWB = "CC_" & Max & ".xlsm"
Application.ScreenUpdating = False
If WorkbookOpen(SupWB) = False Then
Application.DisplayAlerts = False
Workbooks.Open Filename:="CorrectFile location :) \zzzBackup\CC_" & Max & ".xlsm, IgnoreReadOnlyRecommended:=True, UpdateLinks:=False"
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End If
Workbooks(SupWB).Sheets("SupStats").Range("E31:J51" _
).AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("A1:AF2"), _
CopyToRange:=Range("A3:AF3"), Unique:=False
Workbooks(SupWB).Close saveChanges:=False
Workbooks("MGO Overview.xlsb").Activate
End Function
Function WorkbookOpen(WorkBookName As String) As Boolean
'returns true if the workbook is open
WorkbookOpen = False
On Error GoTo WorkBookNotOpen
If Len(Application.Workbooks(WorkBookName).Name) > 0 Then
WorkbookOpen = True
Exit Function
End If
WorkBookNotOpen:
End Function
Any Help would be greatly appreciated,
Regards,
TheHagrid