VBA to PHP to MYSQL – Write from Excel to a Web Page

write vba to php to mysqlI created a Spreadsheet that sends data from Excel to a website, is processed by PHP, then is written to a MYSQL database. In turn the results are viewable via a webpage, Look Here.

To post a message there also, download the VBA-PHP-MYSQL Spreadsheet.

How it works

1. A user enters their Name and a short Message in Excel. When they click the “Send Comment” button, VBA sends the two variables via HTTP to a PHP file sitting on this server.

View the PHP file (I removed the database connection info and changed the extension to text)

2. The PHP file reads the variables sent from VBA and writes them to a MYSQL database, along with the time they were received.

3. Finally I created another PHP file to read from the MYSQL database and display the results.

View the PHP file


The code still needs work, I’m not sure If I’ll make another update or leave it as is. I’ve provided the files as building blocks to save anyone that has an interest in this an hour or two.

I’ve enclosed both PHP files and the unprotected VBA, here’s a screenshot of the database table I used:


Leave a Comment