I've used the same subroutine in previous macros and it worked fine but now it simply won't work.
Public inputFile, outputFile as Worksheet
sub copy()
Set inputFile = excel.Workbooks.Open(get_file(".xlsb", fullpath:=True))
Set outputFile = Workbooks("Sales_Report.xlsm")
inputFile.Sheets("Planilha1").Activate 'error: Method or data member not found (highlights ".Sheets")
inputFile.Sheets("Planilha1").Cells.Select
inputFile.Sheets("Planilha1").Cells.Copy
outputFile.Sheets("Vales").Activate
outputFile.Sheets("Vales").Select.Cells
Selection.Clear
outputFile.Sheets("Vales").Range("A3").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
end sub
As soon as I run the macro the error diplayed is: Method or data member not found and then it highlights the Sheets
method.
I tried changing it to inputfile.Worksheets("Vales")
and make the variables not public but still didn't work.