I created a page on our intranet that shows a number and that
increases for every time the page is opened. It is similar to a
visitors-counter.
When I look at the page with Internet Explorer it works just fine.
Now I want to read this web-page from a MS-Word macro and include the
number as a company wide unique id in my MS-Word document.
Unfortunately, the PHP script doesn't update the counter when I call
it from my MS-Word macro.
How can I force PHP to update my counter when I call it from a VBA
macro?
I am using the following code:
[color=blue]
> Put the following into the Declarations section of your program:
> Declare Function URLDownloadToFi le Lib "urlmon" _
> Alias "URLDownloadToF ileA" _
> (ByVal pCaller As Long, ByVal szURL As String, _
> ByVal szFileName As String, ByVal dwReserved As Long, _
> ByVal lpfnCB As Long) As Long
>
> Put the following as a new function:
> Private Function DownloadFile(UR L As String, LocalFilename As String) _
> As Boolean
> Dim lngRetVal As Long
> lngRetVal = URLDownloadToFi le(0, URL, LocalFilename, 0, 0)
> If lngRetVal = 0 Then DownloadFile = True
> End Function
>
> Then finally use the following code in your main program:
> result = DownloadFile("h ttp://intranet/autoid.php", "c:/ai.txt")[/color]
increases for every time the page is opened. It is similar to a
visitors-counter.
When I look at the page with Internet Explorer it works just fine.
Now I want to read this web-page from a MS-Word macro and include the
number as a company wide unique id in my MS-Word document.
Unfortunately, the PHP script doesn't update the counter when I call
it from my MS-Word macro.
How can I force PHP to update my counter when I call it from a VBA
macro?
I am using the following code:
[color=blue]
> Put the following into the Declarations section of your program:
> Declare Function URLDownloadToFi le Lib "urlmon" _
> Alias "URLDownloadToF ileA" _
> (ByVal pCaller As Long, ByVal szURL As String, _
> ByVal szFileName As String, ByVal dwReserved As Long, _
> ByVal lpfnCB As Long) As Long
>
> Put the following as a new function:
> Private Function DownloadFile(UR L As String, LocalFilename As String) _
> As Boolean
> Dim lngRetVal As Long
> lngRetVal = URLDownloadToFi le(0, URL, LocalFilename, 0, 0)
> If lngRetVal = 0 Then DownloadFile = True
> End Function
>
> Then finally use the following code in your main program:
> result = DownloadFile("h ttp://intranet/autoid.php", "c:/ai.txt")[/color]
Comment