Hello all,
Im trying to send a report as pdf through whatsapp in MS ACCESS, is their any free way?
Regards
How to send report as pdf via Whatsapp?
-
- BronzeLounger
- Posts: 1272
- Joined: 01 May 2016, 09:58
-
- Administrator
- Posts: 78647
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: How to send report as pdf via Whatsapp?
I don't know of a completely free way to do that.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1272
- Joined: 01 May 2016, 09:58
Re: How to send report as pdf via Whatsapp?
Dear Hans,
thank you very much for the reply,
i found this code online using twilio.com API its paid however it give you free trial for test, everything looks good and it create the pdf file but it doesnt send the file
any thought?
thank you very much for the reply,
i found this code online using twilio.com API its paid however it give you free trial for test, everything looks good and it create the pdf file but it doesnt send the file
any thought?
Code: Select all
Private Sub cmdShareWhatsapp_Click()
On Error GoTo ErrorHandler
' Export report as PDF
DoCmd.OpenReport "tblSalary", acViewPreview
DoCmd.OutputTo acOutputReport, "tblSalary", acFormatPDF, "d:\File.pdf", False
DoCmd.Close acReport, "YourReportName"
' Send PDF via WhatsApp using Twilio API
Dim httpReq As Object
Dim postData As String
Dim responseText As String
Set httpReq = CreateObject("MSXML2.XMLHTTP")
' Twilio credentials and WhatsApp number
Dim accountSID As String
Dim authToken As String
Dim whatsappNumber As String
Dim recipientNumber As String
accountSID = "ACb7010eeb6ae0aace0fe361943fbc69c2" ' Your Twilio Account SID
authToken = "3ab0d9ca17c6a671b9589ded1674b993" ' Replace YourTwilioAuthToken with your actual Twilio Auth Token
whatsappNumber = "+14155238886"
recipientNumber = "009647730545717"
' Twilio API endpoint
Dim url As String
url = "https://api.twilio.com/2010-04-01/Accounts/" & accountSID & "/Messages.json"
' Construct POST data
postData = "From=" & whatsappNumber & "&To=" & recipientNumber & "&Body=Your+message+here"
' Set authorization header
Dim authorizationHeader As String
authorizationHeader = "Basic " & Base64Encode(accountSID & ":" & authToken)
' Send POST request
httpReq.Open "POST", url, False
httpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
httpReq.setRequestHeader "Authorization", authorizationHeader
httpReq.send postData
' Get response
responseText = httpReq.responseText
' Handle response as needed
Set httpReq = Nothing
Exit Sub
ErrorHandler:
MsgBox "Error: " & Err.Number & " - " & Err.Description, vbExclamation, "Error"
End Sub
Function Base64Encode(sText As String) As String
Dim arrData() As Byte
arrData = StrConv(sText, vbFromUnicode)
Dim objXML As Object
Set objXML = CreateObject("MSXML2.DOMDocument")
Dim objNode As Object
Set objNode = objXML.createElement("b64")
objNode.DataType = "bin.base64"
objNode.nodeTypedValue = arrData
Base64Encode = objNode.Text
Set objNode = Nothing
Set objXML = Nothing
End Function
-
- Administrator
- Posts: 78647
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: How to send report as pdf via Whatsapp?
I hope someone else can help you with this, that's beyond my expertise.
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1272
- Joined: 01 May 2016, 09:58
Re: How to send report as pdf via Whatsapp?
Thanks a lot for your continues support, lets see if someone can help me.
Regards
Regards
-
- 2StarLounger
- Posts: 120
- Joined: 22 Feb 2022, 09:04
Re: How to send report as pdf via Whatsapp?
Nowhere in that code do you handle the report after it's creation?
Nowhere do I see on their site any mention of attaching files?
Found this.
https://www.twilio.com/docs/flex/end-us ... ttachments
Apparently it can be done with SendKeys, though that can be flaky at times.
https://www.youtube.com/watch?v=XSj8iW7RThU
Amazing what Google can find, if you take the trouble?
https://whatsmate.github.io/2019-12-02- ... p-pdf-vba/
Attached is an Excel file found via Google that also uses the Sendkeys option.
Nowhere do I see on their site any mention of attaching files?
Found this.
https://www.twilio.com/docs/flex/end-us ... ttachments
Apparently it can be done with SendKeys, though that can be flaky at times.
https://www.youtube.com/watch?v=XSj8iW7RThU
Amazing what Google can find, if you take the trouble?
https://whatsmate.github.io/2019-12-02- ... p-pdf-vba/
Attached is an Excel file found via Google that also uses the Sendkeys option.
You do not have the required permissions to view the files attached to this post.
Using Access 2007/2019.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.
Please, please use code tags when posting code snippets, click the </>icon.
Debug.Print is your lifesaver.
-
- BronzeLounger
- Posts: 1272
- Joined: 01 May 2016, 09:58
Re: How to send report as pdf via Whatsapp?
Thank you @Gasman for your support
Regards
Regards