Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • Datastream /
avatar image
Question by mohammad.assadsolimani · May 04, 2020 at 08:58 AM · datastreamvbaschedulevbscript

using schedual task in windows to run Data Stream request

I have 3 Data Stream requests, which are running by opening

I use a vba-code to open these 3 Data-Stream requests


Public Sub cron()
Dim wb As Workbook
Set wb = Workbooks.Open("O:\Corona Reporting\data\Aktien_Aktuell.xlsm")
  wb.Save
' export

    Dim MyFileName As String
    Dim CurrentWB As Workbook, TempWB As Workbook

    Set CurrentWB = wb
    ActiveWorkbook.Worksheets("Data").UsedRange.Copy

    Set TempWB = Application.Workbooks.Add(1)
    With TempWB.Sheets(1).Range("A1")
        .PasteSpecial xlPasteValues
        .PasteSpecial xlPasteFormats
    End With

    'Dim Change below to "- 4"  to become compatible with .xls files
    MyFileName = CurrentWB.Path & "\" & Left(CurrentWB.Name, Len(CurrentWB.Name) - 5) & ".csv"

    Application.DisplayAlerts = False
    TempWB.SaveAs Filename:=MyFileName, FileFormat:=xlCSV, CreateBackup:=False, Local:=True
    TempWB.Close SaveChanges:=False
    Application.DisplayAlerts = True
'end of export
  wb.Close SaveChanges:=False
  '
  Set wb = Workbooks.Open("O:\Corona Reporting\data\Renten_Aktuell.xlsm")
  wb.Save
  wb.Close SaveChanges:=False
  Set wb = Workbooks.Open("O:\Corona Reporting\data\Swaprates_Aktuell.xlsm")
  wb.Save
  wb.Close SaveChanges:=False
  ThisWorkbook.Saved = True
  Application.Quit
End Sub

and finally, I am using a vbs-Script (crontab.vbs) to call the vba file (crona.xlsm) above.

Dim xlApp, xlBook

Set xlApp = CreateObject("Excel.Application")
'~~> Change Path here
Set xlBook = xlApp.Workbooks.Open("O:\Corona Reporting\data\crona.xlsm", 0, True)
xlApp.Run "cron"

xlBook.Saved = True
xlBook.Save
'xlBook.Save
xlBook.Close
xlApp.Quit

Set xlBook = Nothing
Set xlApp = Nothing

WScript.Echo "Finished."
WScript.Quit

Now the problem:

if I execute the vba vba file (crona.xlsm) directly, I get all Data Stream requests. However, if I execute the crontab.vbs the Data Stream requests are not updated!!

1588580937812.png (54.5 KiB)
tempsnip.png (264.6 KiB)

People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Reply

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by Alex Putkov. · May 04, 2020 at 04:34 PM

When you launch Microsoft Excel as an OLE Automation object using the CreateObject command, add-ins, files that are located in the XLStart directory, and the default new workbook are not loaded. See this thread for discussion on similar topic and to learn how to deal with this.

Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
9 People are following this question.

Related Questions

gRTCOMInterface.ProcessRequestTable hangs up

Is there a VBA macro to refresh DataStream DSGRID() functions?

Is there any way to go from SEDOL to mnemonic?

Retrieve Commodity and FX currency rates using DataStream

How to get time series of forecast data in R API

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges