none
I would like to transfer the following code, written orginal in C language, to use in access as VBA. RRS feed

  • Question

  • Dim username As String
         Dim pin As String
         Dim broadcastType As String
         Dim phoneNumberSource As String
         Dim broadcastName As String
         Dim checkCallingWindow As String
         Dim commaDelimitedPhoneNumbers As String
         Dim TTSText As String

     username = "999111999"
     pin = "9991"
     broadcastType = "1"
     phoneNumberSource = "3"
     broadcastName = "Test from Visual Basic"
     checkCallingWindow = "0"
     commaDelimitedPhoneNumbers = "9725551313"
     TTSText = "Hello, This is a text to speech call testing integration with Microsoft Access 2016. Have a nice day."

    Until here is fine_______________________________________________________________________________

        SoapPost = "<?xml version=""1.0"" encoding=""utf-8""?> <soap12:envelope "
    xmlns:            xsi = "&quot;http://www.w3.org/2001/XMLSchema-instance&quot;"
    xml2ns:            xsd = "&quot;http://www.w3.org/2001/XMLSchema&quot;"
          xmlns:soap12="&amp;quot;http://www.w3.org/2003/05/soap-envelope&amp;quot;">&quot;_
        & "<soap12:body>" _
        & "<" & FunctionName & " xmlns="&quot;http://call-em-all.com/&quot;">" _
        & " <myRequest>" _
        & " <username>" & username & "</username>" _
        & " <pin>" & pin & "</pin>" _
        & " <phoneNumberSource>" & phoneNumberSource & "</phoneNumberSource>" _
        & " <broadcastName>" & broadcastName & "</broadcastName>" _
        & " <broadcastType>" & broadcastType & "</broadcastType>" _
        & " <checkCallingWindow>" & checkCallingWindow & "</checkCallingWindow>" _
        & " <commaDelimitedPhoneNumbers>" & commaDelimitedPhoneNumbers & "</commaDelimitedPhoneNumbers>" _
        & " <TTSText>" & TTSText & "</TTSText>" _
        & " </myRequest>" _
        & "</" & FunctionName & ">" _
        & "</soap12:Body>" _
        & "</soap12:Envelope>"

    I would appreciate help in transferrring the above string to VBA or to VB.net.
    Thank you in advance.

    Monday, October 10, 2016 6:06 PM

All replies

  • See if below helps. Problem is XML and VBA uses some charecter differently. Like Quote, Ampersand etc.

    Suggest below for future. Suppose you have a XML document. Copy from starttag to endtag. Goto Excel- > Open a new workbook->Press F2 in any cell - Ctrl+V

    Now the cell is filled with XML text. -> From View Menu/Or From Taskbar start macro recording-> Goto the cell->Press F2 then Press Enter->Stop Recording->Goto VBEditor by Alt+F11. See a macro created with proper quoting which VBA understand.

    'Until here is fine_______________________________________________________________________________
    
    'This need to be assigned to some string or whose output is string
    FunctionName = "ForTestFunctionName"
    
    
        soappost = "<?xml version=""1.0"" encoding=""utf-8""?> <soap12:Envelope" _
     & " xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""" _
     & " xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" " _
     & "xmlns:soap12=""http://www.w3.org/2003/05/soap-envelope"">" _
        & "<soap12:Body>" _
        & "<" & FunctionName & " xmlns=""http://call-em-all.com/"">" _
        & "<myRequest>" _
        & "<username>" & username & "</username>" _
        & "<pin>" & pin & "</pin>" _
        & "<phoneNumberSource>" & phoneNumberSource & "</phoneNumberSource>" _
        & "<broadcastName>" & broadcastName & "</broadcastName>" _
        & "<broadcastType>" & broadcastType & "</broadcastType>" _
        & "<checkCallingWindow>" & checkCallingWindow & "</checkCallingWindow>" _
        & "<commaDelimitedPhoneNumbers>" & commaDelimitedPhoneNumbers & "</commaDelimitedPhoneNumbers>" _
        & "<TTSText>" & TTSText & "</TTSText>" _
        & "</myRequest>" _
        & "</" & FunctionName & ">" _
        & "</soap12:Body>" _
        & "</soap12:Envelope>"
    


    Best Regards,
    Asadulla Javed,
    Jadavpore & Asansol

    Tuesday, October 11, 2016 6:37 AM
    Answerer