Hi All,
I'm wondering if someone can help me. I must admit I have been using these forums for awhile as a guest and been searching for answers instead of posting but could not find anything to solve this.
I have recently written a VBA procedure that activates upon open then goes off to a google drive and opens a file to check against the value in Cell A1. The filename of the file being checked contains the revision number and the check is to ensure a user is using the correct file revision.
In Debug mode the macro works perfectly but in auto mode it crashes after open event from Google with the error code execution has been interrupted. I've tried adding pauses and do loops but to no avail.
Anyone have any suggestions?
Many thanks in advance,
Steve
Private Sub RevCheck()
Dim FileRev As String
Dim RevCheck As String
'Selects destination cell for filename and adds current filename to cell
Range("A15").Select
ActiveCell.FormulaR1C1 = "=cell(""filename"",R1C1)"
'Opens file from google drive and copies cell contents
Workbooks.Open ("https://docs.google.com/uc?export=download&id=0B08sDakjUp91azZhUVhmdThxUDQ&authuser=0")
' Macro Fails here when in autorun mode. It works when you step through with F8
Range("a1").Select
Range("a1").Copy
ActiveWorkbook.Close
'Activates source code workbook
ThisWorkbook.Activate
'Pastes check value from Connect file
Range("a16").PasteSpecial
'identifies variables
FileRev = Range("A15")
RevCheck = Range("A16")
'Performs checks and excecutes accordingly
If InStr(1, FileRev, RevCheck) > 0 Then
MsgBox ("You are using the correct revision of the Autoupload Sheet." & vbNewLine & vbNewLine & "Please continue to complete your upload.")
Else
MsgBox ("You are not using the latest revision of the Autoupload Sheet" & vbNewLine & vbNewLine & "Please download the latest revision from the SEDMS Team Room" & vbNewLine & vbNewLine & "The file will now close.")
ThisWorkbook.Saved = True
ThisWorkbook.Close
End If
End Sub
Bookmarks