I am a completely new to VBA
The goal of my code below is to open another excel workbook on a networked drive that's name changes with the month, copy and paste that data into thisworkbook, and close the file I just opened once its done with its task.
When I F8 through the VBA Editor this code actually works, as it in opens the excel file / copy pastes data, however I'm getting a yellow highlight around the filepath string that I made a variable when I try to actually run the macro (and it does not work).
The filepath is a concatenation of the text&cellreference&text within the Excel workbook, I'm wondering if that is causing the problem. The text is the filepath, the cell reference is the changing month. The month in the filepath is spelled out, aka C:...\location\November 2020 report.xlsx
Sub CopyDay1Report()
Dim Day1Report As Variant
Day1Report = Curtailment.Range("Q4")
'GVS1
Excel.Workbooks.Open (Day1Report)
Sheets("GVS1").Range("A1:M16").Copy
ThisWorkbook.Activate
Range("B27:N42").PasteSpecial xlPasteValuesAndNumberFormats
'GVS2
Excel.Workbooks.Open (Day1Report)
Sheets("GVS2").Range("A1:M16").Copy
ThisWorkbook.Activate
Range("B47:N62").PasteSpecial xlPasteValuesAndNumberFormats
'GVS3
Excel.Workbooks.Open (Day1Report)
Sheets("GVS3").Range("A1:M16").Copy
ThisWorkbook.Activate
Range("B66:N81").PasteSpecial xlPasteValuesAndNumberFormats
'GVS4
Excel.Workbooks.Open (Day1Report)
Sheets("GVS4").Range("A1:M16").Copy
ThisWorkbook.Activate
Range("B84:N99").PasteSpecial xlPasteValuesAndNumberFormats
Workbooks("Day1Report").Close SaveChanges:=False