1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Setting up Environment variable in excel

Discussion in 'VBA Macros' started by AthmanArumugam, Dec 6, 2018.

  1. AthmanArumugam

    AthmanArumugam Member


    I have created an excel macro which uses a variable named URL in it.
    The URl would change repeatedly as I am sharing the workbook with multiple stakeholders in my team. Also I am protecting my worksheet which contains the data and the VBA code.

    Could anyone provide me a way by which I can make the user change the value to the URL from the UI of excel.[bot touching the sheet or the vba]

    Code (vb):

    Sub SubmitTokenisationRequest(strPaylodValue)
        Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
        'URL = "https://payment-gateway-service.apps.nonprod.mem.cloud.autozone.com/commercial/payments-processing/v1/test/token"
       'URL = "https://payments.vantivprelive.com/vap/communicator/online"
       URL = "https://payment-gateway-service-test.apps.nonprod.mem.cloud.autozone.com/commercial/payments-processing/v1/test/token"
        objHTTP.Open "POST", URL, False
        objHTTP.setRequestHeader "Content-Type", "application/xml"
        objHTTP.setRequestHeader "Accept", "application/xml"
        objHTTP.setProxy 2, "proxy.autozone.com:80", ""
        'MsgBox strPaylodValue
       objHTTP.send (strPaylodValue)
        strResponseStatus = objHTTP.Status
        strResponseText = objHTTP.ResponseText
        strResponseText = CStr(strResponseText)
    End Sub

  2. Chihiro

    Chihiro Excel Ninja

    Do you allow them to type in the URL? Or should it be drop down?

    If former, use Application.InputBox

    If latter, I'd recommend using following method.
    1. Have list of URL as array in VBA or loaded from protected sheet.
    2. Use this in Combobox control on userform.
    3. Have them select and call your Submit code from Userform.
  3. AthmanArumugam

    AthmanArumugam Member

    Hi Thanks for your response. It helped me to implement things.

Share This Page