collin8579
New Member
- Joined
- Oct 31, 2017
- Messages
- 20
Good morning,
This macro is causing many peoples excel to crash. I can't reproduce it myself, but about 2/3 of the users have this problem a good bit of the time. Like Crash and reboot and the files are corrupted type of crash.
General purpose:
Open an excel workbook from a network drive
copy and paste from the local workbook to that one
Save the excel file back onto the network drive
****This triggers an internal report to run off the info in the now saved excel sheet****
Refresh a query to update the resultant report
Originally when the problem arose I thought their computers were trying to go "too fast" and put in the application.wait functions. Since I can't replicate it and they can, I figured it might be the computer speed. (I have a better laptop than they)
This didn't help
I'm pretty out of ideas and would appreciate any suggestion you all have.
I feel like it has to do with opening the network file maybe? But I can't pin it down. Especially because I can't replicate the issue myself and when I run it through steps with other people it doesn't crash. (another reason I thought it might be "going too fast")
Thank you for any help/ideas.
This macro is causing many peoples excel to crash. I can't reproduce it myself, but about 2/3 of the users have this problem a good bit of the time. Like Crash and reboot and the files are corrupted type of crash.
General purpose:
Open an excel workbook from a network drive
copy and paste from the local workbook to that one
Save the excel file back onto the network drive
****This triggers an internal report to run off the info in the now saved excel sheet****
Refresh a query to update the resultant report
VBA Code:
Sub updateorders()
Dim MyPath As String
Dim MyFile As String
Dim Wkb2 As Workbook
Dim wb1 As Workbook
Dim lastrow As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
getbook = ActiveWorkbook.Name
Set wb1 = ActiveWorkbook
Application.Wait (Now + TimeValue("00:00:02"))
Set sht = wb1.Worksheets("Orders Working On")
lastrow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
MyFile = "\\netapp4\common\Service Delivery\Reporting and Analysis\order list.xlsx"
Set Wkb2 = Workbooks.Open(MyFile)
Application.Wait (Now + TimeValue("00:00:02"))
Wkb2.Activate
Application.Wait (Now + TimeValue("00:00:02"))
Range("A2:C100").Select
Selection.ClearContents
Application.Wait (Now + TimeValue("00:00:02"))
Wkb2.Worksheets("sheet1").Range("A2:c" & lastrow).Value = wb1.Worksheets("Orders Working On").Range("A2:c" & lastrow).Value
Application.Wait (Now + TimeValue("00:00:005"))
Wkb2.Close savechanges:=True
wb1.Worksheets("CCIReport").Select
Application.Wait (Now + TimeValue("00:00:005"))
On Error Resume Next
ActiveWorkbook.Connections("Query - CCIreport").Refresh
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
wb1.Worksheets("Main").Select
End Sub
Originally when the problem arose I thought their computers were trying to go "too fast" and put in the application.wait functions. Since I can't replicate it and they can, I figured it might be the computer speed. (I have a better laptop than they)
This didn't help
I'm pretty out of ideas and would appreciate any suggestion you all have.
I feel like it has to do with opening the network file maybe? But I can't pin it down. Especially because I can't replicate the issue myself and when I run it through steps with other people it doesn't crash. (another reason I thought it might be "going too fast")
Thank you for any help/ideas.