picklefactory
Well-known Member
- Joined
- Jan 28, 2005
- Messages
- 508
- Office Version
- 365
- Platform
- Windows
Hi folks.
I've started to get this error with one specific wb that we've been running for over 12 months trouble free. Online search has come up with numerous possible reasons for this, but none that seem to fit my circumstances, just wondering if anyone here may have some further knowledge? I'm not sure if it's more a Microsoft issue than Excel, but the fact that it only seems to affect one wb makes me wonder if there's something in that one contributing to the issue.
Also, I've run the wb on 4 different machines, 3 running Office 2016 all see the error, the one machine running Office 365 is error free, the wb is on a shared network, so it's the same wb being run by all.
OK, what the wb does is opens an .xls sheet via VBA, which is an exported .xls from our SAP system, it then opens a 2nd .xls which is purely a flowery display version of the final output data to run in a scrolling .ppt in the main office (The ppt kept glitching with the .xlsm, and would only work with an xls). It just juggles and re-formats the data from the SAP export file and then transfers it to the display xls in a nice, visual format. It also, based on the contents, sends a reminder email out to selected people that there are outstanding issues within the data.
So nothing particularly clever, and has worked perfectly for over 12 months.
I should emphasise though, that I get the 'Unable to read file' error every time, but when I hit the OK button on the error, the wb then carries on and completes all it's functions without further issue.
I'm wondering if there might be a compatibility issue within my code maybe, between the Office versions? Windows and Office seem to update almost weekly, so I'm also wondering if a recent update may have had some effect.
All code enclosed. I have a basic module just setting print area and the major stuff is all in an 'On workbook open' UDF
Any suggestions I could try please?
I've started to get this error with one specific wb that we've been running for over 12 months trouble free. Online search has come up with numerous possible reasons for this, but none that seem to fit my circumstances, just wondering if anyone here may have some further knowledge? I'm not sure if it's more a Microsoft issue than Excel, but the fact that it only seems to affect one wb makes me wonder if there's something in that one contributing to the issue.
Also, I've run the wb on 4 different machines, 3 running Office 2016 all see the error, the one machine running Office 365 is error free, the wb is on a shared network, so it's the same wb being run by all.
OK, what the wb does is opens an .xls sheet via VBA, which is an exported .xls from our SAP system, it then opens a 2nd .xls which is purely a flowery display version of the final output data to run in a scrolling .ppt in the main office (The ppt kept glitching with the .xlsm, and would only work with an xls). It just juggles and re-formats the data from the SAP export file and then transfers it to the display xls in a nice, visual format. It also, based on the contents, sends a reminder email out to selected people that there are outstanding issues within the data.
So nothing particularly clever, and has worked perfectly for over 12 months.
I should emphasise though, that I get the 'Unable to read file' error every time, but when I hit the OK button on the error, the wb then carries on and completes all it's functions without further issue.
I'm wondering if there might be a compatibility issue within my code maybe, between the Office versions? Windows and Office seem to update almost weekly, so I'm also wondering if a recent update may have had some effect.
All code enclosed. I have a basic module just setting print area and the major stuff is all in an 'On workbook open' UDF
Any suggestions I could try please?
Code:
Sub setprintarea()
Dim myrange As String
myrange = Range("R2").Value
ActiveSheet.PageSetup.PrintArea = "$A$1:J" & myrange
End Sub
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveSheet.Unprotect ""
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
ActiveSheet.Protect "", AllowFiltering:=True
End Sub
Private Sub Workbook_Open()
Application.ScreenUpdating = False
ActiveSheet.Unprotect ""
Set wb = Application.Workbooks.Open("M:\COMPANY SHARED\POWERPOINT NOTICE BOARD\LASER BEND ORDERS.xls")
Set wb1 = Application.Workbooks.Open("M:\COMPANY SHARED\POWERPOINT NOTICE BOARD\OUTSTANDING ORDERS DISPLAY.xls")
Workbooks("CHASE OUTSTANDING ORDERS.xlsm").Activate
Workbooks("CHASE OUTSTANDING ORDERS.xlsm").Worksheets("Sheet1").Range("A2:J30").Copy
Workbooks("OUTSTANDING ORDERS DISPLAY.xls").Worksheets("Sheet1").Range("A2:J30").PasteSpecial Paste:=xlPasteValues
wb.Close
wb1.Close savechanges:=True
'GoTo Skip
Dim result As String
If (WorksheetFunction.CountIf(Range("'Sheet1'!I2:'Sheet1'!I20"), "Yes")) = 0 Then
Exit Sub
Else:
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "user1@email.co.uk;"
.CC = "user2@email.co.uk;"
.Subject = "ITEMS ARE OVERDUE ON FABRICATION ORDER SCHEDULE"
.Body = "PLEASE CHECK PROGRESS SHEET FOR DETAILS M:\COMPANY SHARED\POWERPOINT NOTICE BOARD\CHASE OUTSTANDING ORDERS.xlsm"
.NoAging = True
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
SendKeys "{NUMLOCK}%{s}", True
End If
Skip:
ActiveSheet.Protect ""
Application.ScreenUpdating = True
End Sub