Hi Richard, I love your tech help videos and it has helped me a lot. Thank you so much. I would like to learn how to send invoices as pdf via WhatsApp Desktop/Web. Everyone uses WhatsApp these days and it's just easier than emailing. Would that be at all possible.
I don't personally use WhatsApp much myself. I haven't installed it on my phone. I did notice when I was traveling over in Europe over the summer that everyone over there uses it. Anyhow I asked GPT what's possible and here's what it told me:
As for sending invoices as PDFs via WhatsApp Desktop/Web, it's definitely possible, but there's no direct integration in Microsoft Access to send files via WhatsApp. However, here's a simple workaround:
1. Export your invoice as a PDF from Access using the DoCmd.OutputTo method.
2. Save the PDF to your local drive.
3. Open WhatsApp Desktop/Web, find the contact or group, and use the paperclip icon to upload and send the PDF.
WhatsApp does not have an official public API for personal use that supports sending messages with attachments (like PDFs) automatically. The WhatsApp Business API is available, but it's aimed at medium and large businesses, and it comes with limitations and setup requirements.
For personal use, there are a couple of workarounds:
1. Using `Shell` to open WhatsApp Web and simulate the attachment process: This involves VBA automating the browser to navigate to WhatsApp Web and attach a file. However, this is fragile and prone to breaking if WhatsApp changes its UI.
2. Third-party tools and libraries: Some unofficial solutions exist (like Python's `pywhatkit` library), but they violate WhatsApp's terms of service and could result in account suspension.
3. Manual process with automation assistance: You can automate the PDF generation and saving in a specific folder with a VBA script and then give users a message box prompt with the link to the file, making it easier to upload it to WhatsApp manually.
Here's an example of how you can automate generating a PDF and opening WhatsApp Web in a browser to help the user send the file manually:
CodeSub SendInvoiceViaWhatsApp()
Dim strFilePath As String
Dim strContact As String
Dim strMessage As String
Dim strURL As String
' Export the invoice as a PDF
strFilePath = "C:\Invoices\Invoice123.pdf" ' Replace with your actual path
DoCmd.OutputTo acOutputReport, "rptInvoice", acFormatPDF, strFilePath, False
' Set the contact's WhatsApp number (include country code, no spaces or special characters)
strContact = "1234567890" ' Replace with the recipient's WhatsApp number
' Set a default message (URL encoding for spaces and special characters)
strMessage = "Hello, here is your invoice."
' Open WhatsApp Web with the message
Application.FollowHyperlink strURL
MsgBox "PDF generated and ready to send via WhatsApp. Please attach " & strFilePath, vbInformation
End Sub
How this works: 1. The `DoCmd.OutputTo` command exports the invoice as a PDF.
2. It constructs a WhatsApp Web URL with a pre-filled message.
3. `Application.FollowHyperlink` opens WhatsApp Web with the recipient's number and message.
4. The user is prompted to attach the generated PDF manually.
Note: - Automating the file upload is not possible directly due to WhatsApp's limitations.
- This approach is semi-automated. The user still needs to attach the file manually.
- Make sure to enable trusted VBA code execution in Access for this to run without warnings.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visitor Forum.