Hi all,
I have no experience in VBA. I have a workbook that at the moment pulls external data from access and automatically updates a pivot table.
I want it so when I open the file it refreshes the data and then deletes the connection.
I have found two codes that work when I use them seperately, but when i triy to combine I have no luck. They are below...
Sub WorkBook_Open()
ActiveWorkbook.RefreshAll
End Sub
Sub WorkBook_Open()
For i = 1 To ActiveWorkbook.Connections.Count
If ActiveWorkbook.Connections.Count = 0 Then Exit Sub
ActiveWorkbook.Connections.Item(i).Delete
i = i - 1
Next i
End Sub
Thanks for your help
Bookmarks