I'm trying to update SQL Server using Excel on Workbook\_Activate() that grabs the data and sends a reply of `1` in the `Grabbed` field after the data has been loaded to the sheet. It seems like the code isn't executing.

```
Private Sub Workbook_Activate()

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSql As String

Dim conn As New ADODB.Connection
Dim strConn As String
Dim PN As String
Dim partid As Integer

ActiveWorkbook.RefreshAll

strConn = "Driver={SQL Server};Server=servername; Database=CI; UID=userID; PWD=UserPassword"
cn.Open strConn

partid = Worksheets("Sheet3").Range("G2").Value

strSql = "UPDATE dbo.OHW_Schedule SET Grabbed = '1' WHERE ID = '" & partid & "' "

cn.Execute strSql

End Sub

```

when I go through the code line by line everything works fine. I've tried adding a DoEvents after the refresh but still no luck. I've also tried using Workbook\_Open()