question

Upvotes
Accepted
1 1 1 2

VBA: DSGRID formula does not work after file is opened using VBA

Hi,

I am using the following VBA macro

Sub OpenFXRates()
Dim RetVal
Dim FilePath As String

FilePath = """[FilePath]"""

RetVal = Shell("C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE " & FilePath, vbMaximizedFocus)

End Sub

The file that is opened in a new window contains the following formula:

=DSGRID("MLEJREE","RI","-1D","","D","RowHeader=true;ColHeader=true;Code=true;DispSeriesDescription=false;YearlyTSFormat=false;QuarterlyTSFormat=false","")

This gives a #NAME? error even though all TR systems are up and running. Once I close the file and reopen it manually the file runs perfectly.

Any idea what causes this error?

Kind regards,

Floris

eikoneikon-com-apivba
icon clock
10 |1500

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

Hello @f.van.dorp,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

Hello @f.van.dorp,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

1 Answer

· Write an Answer
Upvotes
Accepted
39.4k 77 11 27

Hi @f.van.dorp

This is because Excel opens the workbook before it loads Thomson Reuters Eikon COM add-in (or any other COM add-on for that matter). So at the time the workbook is opened DSGRID worksheet function provided by Eikon Excel add-in is not available and Excel returns #NAME?. Assuming that you enabled automatic sign in for Eikon Excel in Settings - Sign in, and set "Automatically sign me in when" to "I start Microsoft Office", and assuming Excel is in autocalc mode, DSGRID function should resolve and return the data once the add-ins finish loading and once Eikon Excel add-on finishes signing in.

icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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