RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 810
- Office Version
- 365
- Platform
- Windows
Hi all,
Workflow below
In red is where I think this process is going pear-shaped. I am getting a popup on screen that says "Automation Error" - that's it. There's no error code or any other message. When I click ok, everything closes and re-opens with a recovered version.
What I am noticing is that it nearly always re-opens in the same place, sometime after step 5, because it has found tours to put in Automation Hub, but not ranked them yet, or if it has ranked them, it hasn't brought them back into Adstemp.
Alternatively, sometimes it will break without any error code popping up, and in this instance, tours appear to be in Automation Hub, ranked, but not brought back to the temp tab.
Here is a snippet of the code:
In here, what happens is the results of the Automation Hub's start page (sp) are copied out and saved to the given directory, that's all closed, then back on the Automation Hub it copies the results of the automation back to adstemp.
I think it's here that something isn't going right, but I don't know what and Excel isn't being very verbose about it.
Hoping someone can help. This loop is >600 iterations and so far it's broken 14 times - not good for an automated process to replace a manual one!
Workflow below
- ALL Code resides in sheet "Super Automation"
- Information is gathered on "Ads" tab and brought into "adstemp"
- Advert Data is opened and relevant tours gathered
- Advert Data closed, tourlist is loaded into Automation Hub
- Several spreadsheets are now opened (Regional Press Report, Price Panels, Advert Data again) and relevant information is extracted, sheets are then closed
- Points are allocated in Automation Hub and suitable tours are ranked
- This then gets placed back into Ads, Automation Hub is closed, tours are then committed to the Advert Data - opened in Read Only
- If there are existing lines in Advert Data, they are scrubbed out and new ones are written in place
- Advert Data saves and closes, Super Automation saves and drops down a line, the process repeats
In red is where I think this process is going pear-shaped. I am getting a popup on screen that says "Automation Error" - that's it. There's no error code or any other message. When I click ok, everything closes and re-opens with a recovered version.
What I am noticing is that it nearly always re-opens in the same place, sometime after step 5, because it has found tours to put in Automation Hub, but not ranked them yet, or if it has ranked them, it hasn't brought them back into Adstemp.
Alternatively, sometimes it will break without any error code popping up, and in this instance, tours appear to be in Automation Hub, ranked, but not brought back to the temp tab.
Here is a snippet of the code:
Code:
On Error GoTo NoSave
Sp.Copy
Range("1:1").Delete xlUp
If rop = True Then
newdir = "H:\Sales\Regional Press Selections\" & wbyr & "\Automation Files\ROP\wc " & Format(DateValue(WCD), "yyyy-mm-dd")
Else
newdir = "H:\Sales\Regional Press Selections\" & wbyr & "\Automation Files\RT\wc " & Format(DateValue(WCD), "yyyy-mm-dd")
End If
If Dir(newdir, vbDirectory) = vbNullString Then
On Error Resume Next
MkDir newdir
On Error GoTo 0
End If
'nsname = Replace(PaperName, "/", "") & " - " & PaperName !@!
nsname = Replace(PaperName, "/", "&")
Set n = ActiveWorkbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
n.SaveAs filename:=newdir & "\" & nsname & " - Super - " & ".csv", FileFormat:=xlCSV, CreateBackup:=False
n.Close True
Application.DisplayAlerts = True
Application.ScreenUpdating = False
NoSave:
Resume Skip
Skip:
' Bring results back to adstemp
Range("E3:E" & Lastrow).Copy adstemp.Range("H12")
Range("F3:F" & Lastrow).Copy adstemp.Range("I12")
Range("K3:K" & Lastrow).Copy adstemp.Range("J12")
Range("W3:W" & Lastrow).Copy adstemp.Range("K12")
Range("V3:V" & Lastrow).Copy adstemp.Range("L12")
Range("Y3:Y" & Lastrow).Copy adstemp.Range("M12")
Application.EnableEvents = True
Application.DisplayAlerts = False
If ah.ReadOnly = False Then
ah.Close True
Else
ah.Close False
End If
In here, what happens is the results of the Automation Hub's start page (sp) are copied out and saved to the given directory, that's all closed, then back on the Automation Hub it copies the results of the automation back to adstemp.
I think it's here that something isn't going right, but I don't know what and Excel isn't being very verbose about it.
Hoping someone can help. This loop is >600 iterations and so far it's broken 14 times - not good for an automated process to replace a manual one!