Niravvaniya
New Member
Hii chandoo,
Have a good day.
I have little struggle in my VBA code.
Requirement :
I have stock market api for live data (from my broker)
I developed a python for live data feed and get live data in every 10-30 sec in close Excel workbook.(reduce error)
Then I open my master file for get data from close workbook by VBA.
I used power query but it's sowing many error (I done also -background query = false)
Then I goto adodb connection but inthis also I having a runtime error, Sometime excel crash, and many more).
So any best way to get close workbook data without opening it. (Coz python is update data on this file)
If yes then plz suggest
(I using excel 2016 professional Plus).
Tnx
This code I using now.
__________________________________
>>> use code - tags <<<
Have a good day.
I have little struggle in my VBA code.
Requirement :
I have stock market api for live data (from my broker)
I developed a python for live data feed and get live data in every 10-30 sec in close Excel workbook.(reduce error)
Then I open my master file for get data from close workbook by VBA.
I used power query but it's sowing many error (I done also -background query = false)
Then I goto adodb connection but inthis also I having a runtime error, Sometime excel crash, and many more).
So any best way to get close workbook data without opening it. (Coz python is update data on this file)
If yes then plz suggest
(I using excel 2016 professional Plus).
Tnx
This code I using now.
__________________________________
>>> use code - tags <<<
Code:
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Dim sSQLQry As String
Dim ReturnArray
Dim sSQLSting As String
Dim Conn As New ADODB.connection
Dim rs As New ADODB.Recordset
Dim DBpath As String
Dim Ws As Worksheet
Set Ws = ActiveSheet
Sheets("data").Activate
DBpath = "C:\Users\Lenovo\Desktop\Zerodha\Nirav.xlsx"
sconnect = "Provider=MSDASQL.1;DSN=Excel Files;DBQ=" & DBpath & ";HDR=Yes';"
Conn.Open sconnect
sSQLSting = "SELECT * From [live_feed$]"
rs.Open sSQLSting, Conn
Workbooks("data").Sheets("data").Cells(2, 1).CopyFromRecordset rs
rs.Close
Conn.Close
Set rs = Nothing
Set Conn = Nothing
Ws.Activate
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Last edited by a moderator: