https://github.com/tankalxat34/vbaRequests
The simple module for making requests to websites on VBA Excel
https://github.com/tankalxat34/vbaRequests
excel excel-vba requests requests-module vba vba-excel vba-requests vbarequests
Last synced: 5 months ago
JSON representation
The simple module for making requests to websites on VBA Excel
- Host: GitHub
- URL: https://github.com/tankalxat34/vbaRequests
- Owner: tankalxat34
- License: mit
- Created: 2022-03-15T22:49:42.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-01T06:45:20.000Z (about 3 years ago)
- Last Synced: 2024-08-13T07:18:19.867Z (8 months ago)
- Topics: excel, excel-vba, requests, requests-module, vba, vba-excel, vba-requests, vbarequests
- Language: VBA
- Homepage:
- Size: 49.8 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - tankalxat34/vbaRequests - The simple module for making requests to websites on VBA Excel (VBA)
README
# vbaRequests
![]()
![]()

The simple module for making requests to websites
Author: **[tankalxat34](https://github.com/tankalxat34)**
# Installation
[](https://github.com/tankalxat34/vbaRequests/raw/main/vbaRequests.bas)1. Download **[this file](https://github.com/tankalxat34/vbaRequests/raw/main/vbaRequests.bas)** or click to "DOWNLOAD" button.
2. Open your Microsoft Excel Book and in window `"Project - VBAProject"` click on free place and than *"Import file"*.
3. Choice the downloaded file.
4. Enjoy.# Information about "request" public function
| Parameter | Type | Description |
|-------------------|-----------------------------|-------------------------------------------------------------------------------|
| sURL | String | The string URL of web-site |
| headersDictionary | Object Scripting.Dictionary | A dictionary containing headers for making a successful request to a website. You can set the headers yourself, or use the "createHeaders" function to automatically apply default headers to your request |
| username | String | String containing your username for login in website |
| password | String | String containing your password or token for login in website |
| typeRequest | String | String of type for request: "GET", "POST", "PUT" and other types |# Example
## Get your own IP
This code will show you your IP address
```vb
Sub helloworld()
Dim userIP As String
userIP = vbaRequests.request("https://ifconfig.me/ip")
MsgBox userIP
End Sub
```## Response from GitHub
```vb
Sub githubResponse()
Debug.Print vbaRequests.request("https://api.github.com/users/tankalxat34", _
vbaRequests.createHeaders(), _
"tankalxat34", "YOUR_TOKEN", _
"GET")
End Sub
```## Response from [WGMods.net](https://wgmods.net)
Code:
```vb
Sub get_response()
Dim headers As Object
Set headers = CreateObject("Scripting.Dictionary")
headers.Add "x-csrftoken", "NG97PVrI2orqk2UvBXyFB9GpHCNGHHFbbrRJogqbwFCEgTNoLsD383orPnQrq4wb"
headers.Add "x-requested-with", "XMLHttpRequest"Debug.Print vbaRequests.request("https://wgmods.net/api/mods/2548/", vbaRequests.createHeaders(headers))
End Sub
```**[Response from server here](https://github.com/tankalxat34/vbaRequests/blob/examples/wgmods_response.json)**