Ошибка времени выполнения ниже кода
Sub InvoiceReport() Dim myFile As String, lastRow As Long myFile = "C:\Users\iaquino\Documents\Invoices\" & _ Sheets("Invoice").Range("A10") & "_" & _ Sheets("Invoice").Range("F4") & _ Format(Now(), "yyy-mm-dd") & ".pdf" lastRow = Sheets("Invoice File").UsedRange.SpecialCells(xlCellTypeLastCell).Row + 1 'Transfer data to Invoice File Sheets("Invoice File").Cells(lastRow, 1) = Sheets("Invoice").Range("A10") Sheets("Invoice File").Cells(lastRow, 2) = Sheets("Invoice").Range("F4") Sheets("Invoice File").Cells(lastRow, 3) = Sheets("Invoice").Range("F28") Sheets("Invoice File").Cells(lastRow, 4) = Now Sheets("Invoice File").Hyperlinks.Add Anchor:=Sheets("Invoice File").Cells(lastRow, 5), Address:=myFile, TextToDisplay:=myFile 'Create invoice in PDF format Sheets("Invoice").ExportAsFixedFormat Type:=xlTypePDF, Filename:=myFile Application.DisplayAlerts = False 'create invoice in XLSX format ActiveWorkbook.SaveAs "C:\Users\iaquino\Documents\invoices\" & _ Sheets("Sheet1").Range("A10") & "_" & _ Sheets("Invoice").Range("F4") & "_" & _ Format(Now(), "yyy-mm-dd") & "xlsx", FileFormat:=51 Application.DisplayAlerts = True End Sub
Отладка ошибок:-
Ошибка времени выполнения '5'
Листы ("Счет-Фактура").ExportAsFixedFormat Type:=xlTypePDF, Filename:=myFile
Приложение.DisplayAlerts = False
Что я уже пробовал:
Плз дайте срочное решение этой проблемы.