So I have the following code that should open a workbook and run a macro then close it, but obviously it doesn't work. Anyone has any ideas how to make it work? I added 2 new lines believing that I need to return the name a string, but it doesn't work either.
Sub OpenAIR()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.AskToUpdateLinks = False
Dim Latestfolder As String
Dim strName As String
Dim WB As Workbook
Dim macroName As String
Dim FP As String
Latestfolder = ThisWorkbook.Sheets("AIR Admin").Range("D3").Value
strName = ThisWorkbook.Sheets("AIR Admin").Range("D4").Value
FP = ThisWorkbook.Sheets("Admin").Range("B25").Value
WB = Workbooks.Open(FP & Latestfolder & "\Air*")
macroName = "AIRP"
Run "'" & WB & "'!" & macroName
Workbooks(WB).Close SaveChanges:=False
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.AskToUpdateLinks = False
End Sub
Dim WS As String
WS = WB.Name
Bookmarks