ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Force synchronize list with VBA (https://www.excelbanter.com/excel-programming/432868-force-synchronize-list-vba.html)

Sing Chung[_2_]

Force synchronize list with VBA
 
Dear all,
I need help on auto-sync Excel with Sharepoint. I created an Excel 2003
worksheet by right-clicking at Sharepoint site, select "export to Excel". The
worksheet created is then linked to Sharepoint. Everytime when I open the
Exce workbook, it prompts for Enable or Disable background refresh. I always
enable it and leave it open throughout the day. However, I find that it never
refresh during the day, I have to manually clicking on the 'synchronize list'
button to get it refeshed with data on the Sharepoint. I therefore think of
using VBA to force it to refresh with ontime event.
Sub Refresh()
Sheets("CMR").Activate
ThisWorkbook.ActiveSheet.UsedRange.Select
Selection.QueryTables.Refresh BackgroundQuery:=True
ThisWorkbook.Save
End Sub

When reaching the line "Selection.QueryTables.Refresh
BackgroundQuery:=True", I got the error: "Run-time error '438': Object
doesnt' support this prorperty or method."

What should I do to get around it?

Thanks in advance.


All times are GMT +1. The time now is 12:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com