PC Review


Reply
Thread Tools Rate Thread

How to Detect when third part application releases my WorkBook

 
 
Aldo
Guest
Posts: n/a
 
      4th May 2009
Hi there!
We have an application that export data to an MS Excel Workbook.
The workbook is based on a template I created.
When that application finish exporting the data, it pop ups a message and
releases the workbook.

What I need is to find a way (event or other way) to detect the moment that
the third part application releases the workbook, then activating a macro of
my self.

Thanks in advance for any help!
Aldo.
 
Reply With Quote
 
 
 
 
RB Smissaert
Guest
Posts: n/a
 
      4th May 2009
One thing you could do is run a function in a loop that checks if the file
is still
open:

Function FileIsOpen(strFile As String) As Boolean

Dim hFile As Long

On Error GoTo OpenError

hFile = FreeFile

Open strFile For Input Lock Read As #hFile
Close #hFile

Exit Function
OpenError:

FileIsOpen = Err.Number = 70

End Function

So you could run code like this:

'waiting loop that will keep running while file is open
Do While FileIsOpen("C:\Test.xls")

Loop

'now run your own code here


If that third party app has an API that you can access then there might be a
more efficient way.


RBS




"Aldo" <(E-Mail Removed)> wrote in message
news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
> Hi there!
> We have an application that export data to an MS Excel Workbook.
> The workbook is based on a template I created.
> When that application finish exporting the data, it pop ups a message and
> releases the workbook.
>
> What I need is to find a way (event or other way) to detect the moment
> that
> the third part application releases the workbook, then activating a macro
> of
> my self.
>
> Thanks in advance for any help!
> Aldo.


 
Reply With Quote
 
Aldo
Guest
Posts: n/a
 
      5th May 2009
Hi man,
Thanks for answering.

First of all, there is no way I can insert some code into the third-part
application.
After exporting the data to the new wb, the application lives the workbook
open...
So checking if the file is open or closed won't help me...

Thanks,
Aldo.


"RB Smissaert" wrote:
> One thing you could do is run a function in a loop that checks if the file
> is still
> open:
> Function FileIsOpen(strFile As String) As Boolean
> Dim hFile As Long
> On Error GoTo OpenError
> hFile = FreeFile
> Open strFile For Input Lock Read As #hFile
> Close #hFile
> Exit Function
> OpenError:
> FileIsOpen = Err.Number = 70
> End Function
> So you could run code like this:
> 'waiting loop that will keep running while file is open
> Do While FileIsOpen("C:\Test.xls")
> Loop
> 'now run your own code here
> If that third party app has an API that you can access then there might be a
> more efficient way.
> RBS
> "Aldo" <(E-Mail Removed)> wrote in message
> news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
> > Hi there!
> > We have an application that export data to an MS Excel Workbook.
> > The workbook is based on a template I created.
> > When that application finish exporting the data, it pop ups a message and
> > releases the workbook.

> What I need is to find a way (event or other way) to detect the moment
> > that
> > the third part application releases the workbook, then activating a macro
> > of
> > my self.
> >
> > Thanks in advance for any help!
> > Aldo.

 
Reply With Quote
 
RB Smissaert
Guest
Posts: n/a
 
      5th May 2009
Does that third party application have an API, so does it show in the VBE
under Tools, References?
Another way would be to look out for that popup window with the Windows API,
again in a loop.

RBS

"Aldo" <(E-Mail Removed)> wrote in message
news:48785F80-AC13-4657-86ED-(E-Mail Removed)...
> Hi man,
> Thanks for answering.
>
> First of all, there is no way I can insert some code into the third-part
> application.
> After exporting the data to the new wb, the application lives the workbook
> open...
> So checking if the file is open or closed won't help me...
>
> Thanks,
> Aldo.
>
>
> "RB Smissaert" wrote:
>> One thing you could do is run a function in a loop that checks if the
>> file
>> is still
>> open:
>> Function FileIsOpen(strFile As String) As Boolean
>> Dim hFile As Long
>> On Error GoTo OpenError
>> hFile = FreeFile
>> Open strFile For Input Lock Read As #hFile
>> Close #hFile
>> Exit Function
>> OpenError:
>> FileIsOpen = Err.Number = 70
>> End Function
>> So you could run code like this:
>> 'waiting loop that will keep running while file is open
>> Do While FileIsOpen("C:\Test.xls")
>> Loop
>> 'now run your own code here
>> If that third party app has an API that you can access then there might
>> be a
>> more efficient way.
>> RBS
>> "Aldo" <(E-Mail Removed)> wrote in message
>> news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
>> > Hi there!
>> > We have an application that export data to an MS Excel Workbook.
>> > The workbook is based on a template I created.
>> > When that application finish exporting the data, it pop ups a message
>> > and
>> > releases the workbook.

> > What I need is to find a way (event or other way) to detect the moment
>> > that
>> > the third part application releases the workbook, then activating a
>> > macro
>> > of
>> > my self.
>> >
>> > Thanks in advance for any help!
>> > Aldo.


 
Reply With Quote
 
Aldo
Guest
Posts: n/a
 
      5th May 2009
Could you give me some example code?
Thanks.


"RB Smissaert" wrote:

> Does that third party application have an API, so does it show in the VBE
> under Tools, References?
> Another way would be to look out for that popup window with the Windows API,
> again in a loop.
>
> RBS
>
> "Aldo" <(E-Mail Removed)> wrote in message
> news:48785F80-AC13-4657-86ED-(E-Mail Removed)...
> > Hi man,
> > Thanks for answering.
> >
> > First of all, there is no way I can insert some code into the third-part
> > application.
> > After exporting the data to the new wb, the application lives the workbook
> > open...
> > So checking if the file is open or closed won't help me...
> >
> > Thanks,
> > Aldo.
> >
> >
> > "RB Smissaert" wrote:
> >> One thing you could do is run a function in a loop that checks if the
> >> file
> >> is still
> >> open:
> >> Function FileIsOpen(strFile As String) As Boolean
> >> Dim hFile As Long
> >> On Error GoTo OpenError
> >> hFile = FreeFile
> >> Open strFile For Input Lock Read As #hFile
> >> Close #hFile
> >> Exit Function
> >> OpenError:
> >> FileIsOpen = Err.Number = 70
> >> End Function
> >> So you could run code like this:
> >> 'waiting loop that will keep running while file is open
> >> Do While FileIsOpen("C:\Test.xls")
> >> Loop
> >> 'now run your own code here
> >> If that third party app has an API that you can access then there might
> >> be a
> >> more efficient way.
> >> RBS
> >> "Aldo" <(E-Mail Removed)> wrote in message
> >> news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
> >> > Hi there!
> >> > We have an application that export data to an MS Excel Workbook.
> >> > The workbook is based on a template I created.
> >> > When that application finish exporting the data, it pop ups a message
> >> > and
> >> > releases the workbook.
> > > What I need is to find a way (event or other way) to detect the moment
> >> > that
> >> > the third part application releases the workbook, then activating a
> >> > macro
> >> > of
> >> > my self.
> >> >
> >> > Thanks in advance for any help!
> >> > Aldo.

>
>

 
Reply With Quote
 
RB Smissaert
Guest
Posts: n/a
 
      5th May 2009
Something like this:

Private Declare Function FindWindow _
Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Sub Test()

Do While FindWindow(vbNullString, "caption of the popup window") = 0
DoEvents
Loop

'run your code here

End Sub


RBS


"Aldo" <(E-Mail Removed)> wrote in message
news:51F91DC1-6D22-4B70-96B0-(E-Mail Removed)...
> Could you give me some example code?
> Thanks.
>
>
> "RB Smissaert" wrote:
>
>> Does that third party application have an API, so does it show in the VBE
>> under Tools, References?
>> Another way would be to look out for that popup window with the Windows
>> API,
>> again in a loop.
>>
>> RBS
>>
>> "Aldo" <(E-Mail Removed)> wrote in message
>> news:48785F80-AC13-4657-86ED-(E-Mail Removed)...
>> > Hi man,
>> > Thanks for answering.
>> >
>> > First of all, there is no way I can insert some code into the
>> > third-part
>> > application.
>> > After exporting the data to the new wb, the application lives the
>> > workbook
>> > open...
>> > So checking if the file is open or closed won't help me...
>> >
>> > Thanks,
>> > Aldo.
>> >
>> >
>> > "RB Smissaert" wrote:
>> >> One thing you could do is run a function in a loop that checks if the
>> >> file
>> >> is still
>> >> open:
>> >> Function FileIsOpen(strFile As String) As Boolean
>> >> Dim hFile As Long
>> >> On Error GoTo OpenError
>> >> hFile = FreeFile
>> >> Open strFile For Input Lock Read As #hFile
>> >> Close #hFile
>> >> Exit Function
>> >> OpenError:
>> >> FileIsOpen = Err.Number = 70
>> >> End Function
>> >> So you could run code like this:
>> >> 'waiting loop that will keep running while file is open
>> >> Do While FileIsOpen("C:\Test.xls")
>> >> Loop
>> >> 'now run your own code here
>> >> If that third party app has an API that you can access then there
>> >> might
>> >> be a
>> >> more efficient way.
>> >> RBS
>> >> "Aldo" <(E-Mail Removed)> wrote in message
>> >> news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
>> >> > Hi there!
>> >> > We have an application that export data to an MS Excel Workbook.
>> >> > The workbook is based on a template I created.
>> >> > When that application finish exporting the data, it pop ups a
>> >> > message
>> >> > and
>> >> > releases the workbook.
>> > > What I need is to find a way (event or other way) to detect the
>> > > moment
>> >> > that
>> >> > the third part application releases the workbook, then activating a
>> >> > macro
>> >> > of
>> >> > my self.
>> >> >
>> >> > Thanks in advance for any help!
>> >> > Aldo.

>>
>>


 
Reply With Quote
 
Aldo
Guest
Posts: n/a
 
      6th May 2009
Thanks man!


"RB Smissaert" wrote:

> Something like this:
>
> Private Declare Function FindWindow _
> Lib "user32" Alias "FindWindowA" _
> (ByVal lpClassName As String, _
> ByVal lpWindowName As String) As Long
>
> Sub Test()
>
> Do While FindWindow(vbNullString, "caption of the popup window") = 0
> DoEvents
> Loop
>
> 'run your code here
>
> End Sub
>
>
> RBS
>
>
> "Aldo" <(E-Mail Removed)> wrote in message
> news:51F91DC1-6D22-4B70-96B0-(E-Mail Removed)...
> > Could you give me some example code?
> > Thanks.
> >
> >
> > "RB Smissaert" wrote:
> >
> >> Does that third party application have an API, so does it show in the VBE
> >> under Tools, References?
> >> Another way would be to look out for that popup window with the Windows
> >> API,
> >> again in a loop.
> >>
> >> RBS
> >>
> >> "Aldo" <(E-Mail Removed)> wrote in message
> >> news:48785F80-AC13-4657-86ED-(E-Mail Removed)...
> >> > Hi man,
> >> > Thanks for answering.
> >> >
> >> > First of all, there is no way I can insert some code into the
> >> > third-part
> >> > application.
> >> > After exporting the data to the new wb, the application lives the
> >> > workbook
> >> > open...
> >> > So checking if the file is open or closed won't help me...
> >> >
> >> > Thanks,
> >> > Aldo.
> >> >
> >> >
> >> > "RB Smissaert" wrote:
> >> >> One thing you could do is run a function in a loop that checks if the
> >> >> file
> >> >> is still
> >> >> open:
> >> >> Function FileIsOpen(strFile As String) As Boolean
> >> >> Dim hFile As Long
> >> >> On Error GoTo OpenError
> >> >> hFile = FreeFile
> >> >> Open strFile For Input Lock Read As #hFile
> >> >> Close #hFile
> >> >> Exit Function
> >> >> OpenError:
> >> >> FileIsOpen = Err.Number = 70
> >> >> End Function
> >> >> So you could run code like this:
> >> >> 'waiting loop that will keep running while file is open
> >> >> Do While FileIsOpen("C:\Test.xls")
> >> >> Loop
> >> >> 'now run your own code here
> >> >> If that third party app has an API that you can access then there
> >> >> might
> >> >> be a
> >> >> more efficient way.
> >> >> RBS
> >> >> "Aldo" <(E-Mail Removed)> wrote in message
> >> >> news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
> >> >> > Hi there!
> >> >> > We have an application that export data to an MS Excel Workbook.
> >> >> > The workbook is based on a template I created.
> >> >> > When that application finish exporting the data, it pop ups a
> >> >> > message
> >> >> > and
> >> >> > releases the workbook.
> >> > > What I need is to find a way (event or other way) to detect the
> >> > > moment
> >> >> > that
> >> >> > the third part application releases the workbook, then activating a
> >> >> > macro
> >> >> > of
> >> >> > my self.
> >> >> >
> >> >> > Thanks in advance for any help!
> >> >> > Aldo.
> >>
> >>

>
>

 
Reply With Quote
 
RB Smissaert
Guest
Posts: n/a
 
      6th May 2009
Did it work OK?

RBS


"Aldo" <(E-Mail Removed)> wrote in message
news:97CE5DA2-8B46-4752-9715-(E-Mail Removed)...
> Thanks man!
>
>
> "RB Smissaert" wrote:
>
>> Something like this:
>>
>> Private Declare Function FindWindow _
>> Lib "user32" Alias "FindWindowA" _
>> (ByVal lpClassName As String, _
>> ByVal lpWindowName As String) As Long
>>
>> Sub Test()
>>
>> Do While FindWindow(vbNullString, "caption of the popup window") = 0
>> DoEvents
>> Loop
>>
>> 'run your code here
>>
>> End Sub
>>
>>
>> RBS
>>
>>
>> "Aldo" <(E-Mail Removed)> wrote in message
>> news:51F91DC1-6D22-4B70-96B0-(E-Mail Removed)...
>> > Could you give me some example code?
>> > Thanks.
>> >
>> >
>> > "RB Smissaert" wrote:
>> >
>> >> Does that third party application have an API, so does it show in the
>> >> VBE
>> >> under Tools, References?
>> >> Another way would be to look out for that popup window with the
>> >> Windows
>> >> API,
>> >> again in a loop.
>> >>
>> >> RBS
>> >>
>> >> "Aldo" <(E-Mail Removed)> wrote in message
>> >> news:48785F80-AC13-4657-86ED-(E-Mail Removed)...
>> >> > Hi man,
>> >> > Thanks for answering.
>> >> >
>> >> > First of all, there is no way I can insert some code into the
>> >> > third-part
>> >> > application.
>> >> > After exporting the data to the new wb, the application lives the
>> >> > workbook
>> >> > open...
>> >> > So checking if the file is open or closed won't help me...
>> >> >
>> >> > Thanks,
>> >> > Aldo.
>> >> >
>> >> >
>> >> > "RB Smissaert" wrote:
>> >> >> One thing you could do is run a function in a loop that checks if
>> >> >> the
>> >> >> file
>> >> >> is still
>> >> >> open:
>> >> >> Function FileIsOpen(strFile As String) As Boolean
>> >> >> Dim hFile As Long
>> >> >> On Error GoTo OpenError
>> >> >> hFile = FreeFile
>> >> >> Open strFile For Input Lock Read As #hFile
>> >> >> Close #hFile
>> >> >> Exit Function
>> >> >> OpenError:
>> >> >> FileIsOpen = Err.Number = 70
>> >> >> End Function
>> >> >> So you could run code like this:
>> >> >> 'waiting loop that will keep running while file is open
>> >> >> Do While FileIsOpen("C:\Test.xls")
>> >> >> Loop
>> >> >> 'now run your own code here
>> >> >> If that third party app has an API that you can access then there
>> >> >> might
>> >> >> be a
>> >> >> more efficient way.
>> >> >> RBS
>> >> >> "Aldo" <(E-Mail Removed)> wrote in message
>> >> >> news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
>> >> >> > Hi there!
>> >> >> > We have an application that export data to an MS Excel Workbook.
>> >> >> > The workbook is based on a template I created.
>> >> >> > When that application finish exporting the data, it pop ups a
>> >> >> > message
>> >> >> > and
>> >> >> > releases the workbook.
>> >> > > What I need is to find a way (event or other way) to detect the
>> >> > > moment
>> >> >> > that
>> >> >> > the third part application releases the workbook, then activating
>> >> >> > a
>> >> >> > macro
>> >> >> > of
>> >> >> > my self.
>> >> >> >
>> >> >> > Thanks in advance for any help!
>> >> >> > Aldo.
>> >>
>> >>

>>
>>


 
Reply With Quote
 
Aldo
Guest
Posts: n/a
 
      7th May 2009
Yeap! ) Its working.
Below the code:
Private Sub Workbook_Open()
Dim VBEHwnd As Long
Dim workDone As Boolean

' MsgBox ("Report sent to Excel")
VBEHwnd = FindWindow(vbNullString, "Report sent to Excel")
workDone = False

'Loop untill finds Third part application pop-up message.
Do While Not workDone And VBEHwnd = 0
'Do my stuff
Sheets("DataSheet").Tab.Color = 5287936
Sheets("DataSheet").Visible = True
Sheets("DataSheet").Select
Call PTSetups: workDone = True
Loop
End Sub

Regards,
Aldo.



"RB Smissaert" wrote:

> Did it work OK?
>
> RBS
>
>
> "Aldo" <(E-Mail Removed)> wrote in message
> news:97CE5DA2-8B46-4752-9715-(E-Mail Removed)...
> > Thanks man!
> >
> >
> > "RB Smissaert" wrote:
> >
> >> Something like this:
> >>
> >> Private Declare Function FindWindow _
> >> Lib "user32" Alias "FindWindowA" _
> >> (ByVal lpClassName As String, _
> >> ByVal lpWindowName As String) As Long
> >>
> >> Sub Test()
> >>
> >> Do While FindWindow(vbNullString, "caption of the popup window") = 0
> >> DoEvents
> >> Loop
> >>
> >> 'run your code here
> >>
> >> End Sub
> >>
> >>
> >> RBS
> >>
> >>
> >> "Aldo" <(E-Mail Removed)> wrote in message
> >> news:51F91DC1-6D22-4B70-96B0-(E-Mail Removed)...
> >> > Could you give me some example code?
> >> > Thanks.
> >> >
> >> >
> >> > "RB Smissaert" wrote:
> >> >
> >> >> Does that third party application have an API, so does it show in the
> >> >> VBE
> >> >> under Tools, References?
> >> >> Another way would be to look out for that popup window with the
> >> >> Windows
> >> >> API,
> >> >> again in a loop.
> >> >>
> >> >> RBS
> >> >>
> >> >> "Aldo" <(E-Mail Removed)> wrote in message
> >> >> news:48785F80-AC13-4657-86ED-(E-Mail Removed)...
> >> >> > Hi man,
> >> >> > Thanks for answering.
> >> >> >
> >> >> > First of all, there is no way I can insert some code into the
> >> >> > third-part
> >> >> > application.
> >> >> > After exporting the data to the new wb, the application lives the
> >> >> > workbook
> >> >> > open...
> >> >> > So checking if the file is open or closed won't help me...
> >> >> >
> >> >> > Thanks,
> >> >> > Aldo.
> >> >> >
> >> >> >
> >> >> > "RB Smissaert" wrote:
> >> >> >> One thing you could do is run a function in a loop that checks if
> >> >> >> the
> >> >> >> file
> >> >> >> is still
> >> >> >> open:
> >> >> >> Function FileIsOpen(strFile As String) As Boolean
> >> >> >> Dim hFile As Long
> >> >> >> On Error GoTo OpenError
> >> >> >> hFile = FreeFile
> >> >> >> Open strFile For Input Lock Read As #hFile
> >> >> >> Close #hFile
> >> >> >> Exit Function
> >> >> >> OpenError:
> >> >> >> FileIsOpen = Err.Number = 70
> >> >> >> End Function
> >> >> >> So you could run code like this:
> >> >> >> 'waiting loop that will keep running while file is open
> >> >> >> Do While FileIsOpen("C:\Test.xls")
> >> >> >> Loop
> >> >> >> 'now run your own code here
> >> >> >> If that third party app has an API that you can access then there
> >> >> >> might
> >> >> >> be a
> >> >> >> more efficient way.
> >> >> >> RBS
> >> >> >> "Aldo" <(E-Mail Removed)> wrote in message
> >> >> >> news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
> >> >> >> > Hi there!
> >> >> >> > We have an application that export data to an MS Excel Workbook.
> >> >> >> > The workbook is based on a template I created.
> >> >> >> > When that application finish exporting the data, it pop ups a
> >> >> >> > message
> >> >> >> > and
> >> >> >> > releases the workbook.
> >> >> > > What I need is to find a way (event or other way) to detect the
> >> >> > > moment
> >> >> >> > that
> >> >> >> > the third part application releases the workbook, then activating
> >> >> >> > a
> >> >> >> > macro
> >> >> >> > of
> >> >> >> > my self.
> >> >> >> >
> >> >> >> > Thanks in advance for any help!
> >> >> >> > Aldo.
> >> >>
> >> >>
> >>
> >>

>
>

 
Reply With Quote
 
RB Smissaert
Guest
Posts: n/a
 
      7th May 2009
OK, nice and simple, well done.

RBS


"Aldo" <(E-Mail Removed)> wrote in message
news:F9A1378F-36AB-41F5-B715-(E-Mail Removed)...
> Yeap! ) Its working.
> Below the code:
> Private Sub Workbook_Open()
> Dim VBEHwnd As Long
> Dim workDone As Boolean
>
> ' MsgBox ("Report sent to Excel")
> VBEHwnd = FindWindow(vbNullString, "Report sent to Excel")
> workDone = False
>
> 'Loop untill finds Third part application pop-up message.
> Do While Not workDone And VBEHwnd = 0
> 'Do my stuff
> Sheets("DataSheet").Tab.Color = 5287936
> Sheets("DataSheet").Visible = True
> Sheets("DataSheet").Select
> Call PTSetups: workDone = True
> Loop
> End Sub
>
> Regards,
> Aldo.
>
>
>
> "RB Smissaert" wrote:
>
>> Did it work OK?
>>
>> RBS
>>
>>
>> "Aldo" <(E-Mail Removed)> wrote in message
>> news:97CE5DA2-8B46-4752-9715-(E-Mail Removed)...
>> > Thanks man!
>> >
>> >
>> > "RB Smissaert" wrote:
>> >
>> >> Something like this:
>> >>
>> >> Private Declare Function FindWindow _
>> >> Lib "user32" Alias "FindWindowA" _
>> >> (ByVal lpClassName As String, _
>> >> ByVal lpWindowName As String) As Long
>> >>
>> >> Sub Test()
>> >>
>> >> Do While FindWindow(vbNullString, "caption of the popup window") = 0
>> >> DoEvents
>> >> Loop
>> >>
>> >> 'run your code here
>> >>
>> >> End Sub
>> >>
>> >>
>> >> RBS
>> >>
>> >>
>> >> "Aldo" <(E-Mail Removed)> wrote in message
>> >> news:51F91DC1-6D22-4B70-96B0-(E-Mail Removed)...
>> >> > Could you give me some example code?
>> >> > Thanks.
>> >> >
>> >> >
>> >> > "RB Smissaert" wrote:
>> >> >
>> >> >> Does that third party application have an API, so does it show in
>> >> >> the
>> >> >> VBE
>> >> >> under Tools, References?
>> >> >> Another way would be to look out for that popup window with the
>> >> >> Windows
>> >> >> API,
>> >> >> again in a loop.
>> >> >>
>> >> >> RBS
>> >> >>
>> >> >> "Aldo" <(E-Mail Removed)> wrote in message
>> >> >> news:48785F80-AC13-4657-86ED-(E-Mail Removed)...
>> >> >> > Hi man,
>> >> >> > Thanks for answering.
>> >> >> >
>> >> >> > First of all, there is no way I can insert some code into the
>> >> >> > third-part
>> >> >> > application.
>> >> >> > After exporting the data to the new wb, the application lives the
>> >> >> > workbook
>> >> >> > open...
>> >> >> > So checking if the file is open or closed won't help me...
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Aldo.
>> >> >> >
>> >> >> >
>> >> >> > "RB Smissaert" wrote:
>> >> >> >> One thing you could do is run a function in a loop that checks
>> >> >> >> if
>> >> >> >> the
>> >> >> >> file
>> >> >> >> is still
>> >> >> >> open:
>> >> >> >> Function FileIsOpen(strFile As String) As Boolean
>> >> >> >> Dim hFile As Long
>> >> >> >> On Error GoTo OpenError
>> >> >> >> hFile = FreeFile
>> >> >> >> Open strFile For Input Lock Read As #hFile
>> >> >> >> Close #hFile
>> >> >> >> Exit Function
>> >> >> >> OpenError:
>> >> >> >> FileIsOpen = Err.Number = 70
>> >> >> >> End Function
>> >> >> >> So you could run code like this:
>> >> >> >> 'waiting loop that will keep running while file is open
>> >> >> >> Do While FileIsOpen("C:\Test.xls")
>> >> >> >> Loop
>> >> >> >> 'now run your own code here
>> >> >> >> If that third party app has an API that you can access then
>> >> >> >> there
>> >> >> >> might
>> >> >> >> be a
>> >> >> >> more efficient way.
>> >> >> >> RBS
>> >> >> >> "Aldo" <(E-Mail Removed)> wrote in message
>> >> >> >> news:C6FB22DB-DB91-42BC-9B78-(E-Mail Removed)...
>> >> >> >> > Hi there!
>> >> >> >> > We have an application that export data to an MS Excel
>> >> >> >> > Workbook.
>> >> >> >> > The workbook is based on a template I created.
>> >> >> >> > When that application finish exporting the data, it pop ups a
>> >> >> >> > message
>> >> >> >> > and
>> >> >> >> > releases the workbook.
>> >> >> > > What I need is to find a way (event or other way) to detect the
>> >> >> > > moment
>> >> >> >> > that
>> >> >> >> > the third part application releases the workbook, then
>> >> >> >> > activating
>> >> >> >> > a
>> >> >> >> > macro
>> >> >> >> > of
>> >> >> >> > my self.
>> >> >> >> >
>> >> >> >> > Thanks in advance for any help!
>> >> >> >> > Aldo.
>> >> >>
>> >> >>
>> >>
>> >>

>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update one workbook based on another workbook from a part number? CAM Microsoft Excel Discussion 2 5th Apr 2009 01:35 AM
Detect Whether Workbook Has Pwd Without Opening It =?Utf-8?B?TURX?= Microsoft Excel Programming 0 5th Apr 2006 04:58 PM
How to detect if a workbook is hidden through VBA Aaron Microsoft Excel Programming 2 13th Oct 2005 07:10 PM
[ANN] nVision Software Technologies Releases New Application Service Level Auditing Tool Johnny Anderson Microsoft Dot NET Framework 0 13th Jul 2005 10:33 PM
How to hide a workbook and to detect a hidden workbook in visual basic jn1971 Microsoft Excel Programming 0 5th May 2004 10:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:39 AM.