In RTD ProgID Server String1 String2 passing array for String2 String3 and so on

0 votes

Is there any way to pass myStringArray to the RTD function?

Data = "A,B,C"
Dim myStringArray() As String     `
myStringArray = Split(Data, ",")`

Application.WorksheetFunction.RTD("rtd.server.1", "", "" + URL+ "", "User", "Query", myStringArray)

Expecting the RTD server to receive "URL", "User", "Query", "A", "B", and "C" as the arguments. I tried the above but it did not work.

Jan 23, 2023 in Others by Kithuzzz
• 38,000 points
428 views

1 answer to this question.

0 votes

Since WorksheetFunction.RTD() method (https://learn.microsoft.com/en-us/office/vba/api/excel.worksheetfunction.rtdsignature (i.e.: how many parameters it is accepting and of which type), you could use a "Preprocessor", like the following:

Sub PreProcessingForRTD(progID As Variant, server As Variant, topic1 As Variant, ParamArray otherTopics() As Variant)

    Dim topics(1 To 28) As Variant
    
    topics(1) = topic1
    
    Dim iTopic As Long
        iTopic = 1
        Dim arg As Variant
        For Each arg In otherTopics
            Select Case True
                Case IsArray(arg)
                    Dim argArg As Variant
                        For Each argArg In arg
                            iTopic = iTopic + 1
                            topics(iTopic) = argArg
                        Next
                Case Else
                    iTopic = iTopic + 1
                    topics(iTopic) = arg
                    
            End Select
        Next

    'change 'Debug.Print' to whatever real usage you are making of 'Application.WorksheetFunction.RTD()'
    Debug.Print Application.WorksheetFunction.RTD(progID, server, topics(1), _
                                                  topics(2), topics(3), topics(4), topics(5), topics(6), topics(7), topics(8), topics(9), topics(10), topics(11), topics(12), topics(13), topics(14), topics(15), topics(16), topics(17), topics(18), topics(19), topics(20), topics(21), topics(22), topics(23), topics(24), topics(25), topics(26), topics(27), topics(28))

    
End Sub

That you will use in your "main" sub as follows:

Dim DATA As String
    DATA = "A,B,C"

Dim myStringArray() As String
    myStringArray = Split(DATA, ",")

Dim url As String
    url = "myURL"
    
PreProcessingForRTD "rtd.server.1", "", "" + url + "", "User", "Query", myStringArray
answered Jan 23, 2023 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
0 answers

How implement SEO (Metatags) in Angular 2 (with Angular universal for rendering on server side)?

I'm searching a fully working example about ...READ MORE

Feb 21, 2022 in Others by Kichu
• 19,040 points
797 views
0 votes
1 answer

Excel formula for searching two text in one cell and return values based on the result

You can include a second IF within ...READ MORE

answered Oct 10, 2022 in Others by narikkadan
• 63,600 points
1,224 views
0 votes
1 answer

Highlight duplicates with only 2 colors

Try this: Sub ColorCompanyDuplicates2() 'best practice to define all ...READ MORE

answered Mar 27, 2023 in Others by narikkadan
• 63,600 points
440 views
0 votes
0 answers

Convert Rows to Columns with values in Excel using custom format

1 I having a Excel sheet with 1 ...READ MORE

Feb 17, 2022 in Others by Edureka
• 13,690 points
1,000 views
0 votes
1 answer

Remove formulas from all worksheets in Excel using VBA

Try this : Option Explicit Sub test1() ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,600 points
2,082 views
0 votes
1 answer

Calculate monthly average from daily data without PivotTable

Assuming you have the months in column D enter ...READ MORE

answered Oct 3, 2022 in Others by narikkadan
• 63,600 points
1,788 views
0 votes
1 answer

How implement SEO (Metatags) in Angular 2 (with Angular universal for rendering on server side)?

https://github.com/angular/universal-starter follow this repo among it there ...READ MORE

answered Feb 22, 2022 in Others by narikkadan
• 63,600 points
1,127 views
0 votes
1 answer

How implement SEO (Metatags) in Angular 2 (with Angular universal for rendering on server side)?

 in this https://github.com/angular/universal-starter you can see  angular-meta.ts service that handles ...READ MORE

answered Feb 26, 2022 in Others by narikkadan
• 63,600 points
696 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP