How to run Excel VBA by PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mainicia
Forum Newbie
Posts: 3
Joined: Thu Sep 11, 2008 2:23 am

How to run Excel VBA by PHP

Post by mainicia »

I have some utillity that written on excel and using VBA
Anyway, how can I call that procedure on PHP client side such as...

client ---> php ---> server ---> vba on excel ---> php ---> client

anybody know how to do that? :?:
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Re: How to run Excel VBA by PHP

Post by ddragas »

I don't think this is possible and php is server side, not client side
mainicia
Forum Newbie
Posts: 3
Joined: Thu Sep 11, 2008 2:23 am

Re: How to run Excel VBA by PHP

Post by mainicia »

I have to run VBA on my website. anyone have solution?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: How to run Excel VBA by PHP

Post by alex.barylski »

While it's technically possible...it's easier to accept defeat and find an alternative solution. Why do you need to run VBA under PHP?

Is the server Windows powered? Then you could maybe write an extension wrapper around the VBA DLL's and pass VB code to the PHP extension function for execution. Any VBA interpretor would work but that is a massive complex task for anyone, nevermind someone who is asking how this would be done.
mainicia
Forum Newbie
Posts: 3
Joined: Thu Sep 11, 2008 2:23 am

Re: How to run Excel VBA by PHP

Post by mainicia »

I have some calculation function on VBA of excel.
I can't rewrite in php script because it need some specific function on excel.

so there's more condition is that excel must can be run on web application too.

that's why I need some code to run VBA in excel on my web server station.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: How to run Excel VBA by PHP

Post by onion2k »

PHP can connect to Excel using COM, so you should be able to use that. You'll need to be using a Windows server, and it'll need to have Excel installed on it (or maybe just Excel Viewer..). Unfortunately it's the sort of thing that noone ever really does because most people who need this sort of functionality build their websites in .NET, so I imagine you'll need to work out exactly how to do on your own.

http://sydphp.org/presentations/010606-excel.html - Page 7 gives you a basic example.

http://msdn.microsoft.com/en-us/library ... e.11).aspx is the documentation for the Excel application object.
Post Reply