Showing posts with label Excel with sql server. Show all posts
Showing posts with label Excel with sql server. Show all posts

Monday, 24 June 2013

Excel file fetch data from sql server in 1 second refresh

1.      
2.       Connect with sql server

3.      

4.       Refresh connection property



5.        Go to developer tool à click on visual stio
Click on this work book code

Private Sub Workbook_Open()

Application.OnTime Now + TimeValue("00:00:01"), "SaveThis"

End Sub






6.       Add new module code id
Sub SaveThis()
Application.DisplayAlerts = False
ThisWorkbook.RefreshAll
Application.DisplayAlerts = True
Application.OnTime Now + TimeValue("00:00:01"), "SaveThis"
End Sub

Run use it