I have this code, which works perfectly in another module, but when I copied it over to module on which I'm working now, It throws
"error 1004 method open of object workbooks failed"
on the line with "Set TlWb" when I either input the file via dialog box or let the program decide for himself and I can't figure out why, because it seems so banal and there are not many options where it can go wrong. I'm pretty sure that the paths I'm providing to the program are correct and everything is DIMmed properly.
Here is the code:
'opens open prompt for ABII Parallel Import Tracker - Month/Year.xlsx, on cancel opens actual month
MsgBox "Select ABII Parallel Import Tracker - Month/Year.xlsx file to open. Cancel opens actual month"
With Application.FileDialog(msoFileDialogOpen)
.Show
If .SelectedItems.Count = 1 Then
TlWbPath = .SelectedItems(1)
End If
End With
If TlWbPath <> "" Then
Set TlWb = Workbooks.Open(TlWbPath)
Else: Set TlWb = Workbooks.Open(traceLogPath & "ABII Parallel Import Tracker - " & Format(Date, "mmm-yyyy") & ".xlsx")
End If
Well in the end I figured it out. The input file was corrupted, so I opened it manually and resaved it. Corruption was caused by not copying sources for dropdown list on another sheet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With