Sign in to follow this  
Followers 0
Altrez

Trouble with Event Scripting Concepts

4 posts in this topic

Hello All,

Let me first say once again that this forum is great! So much good information here. I have a question about events and I cant seem to get the logic figured out. What I am trying to acomplish is to have my script open an excel file wait for the user to enter the inforamtion and when the user closes the excel file, i would like the script to contiue to run and finish at that point.

I have looked for examples and trolled the forums for ways to do it. Is there something I am missing in the docs? Are there any examples of this type of code out there?

Thank you all so much!

Share this post


Link to post
Share on other sites



Something like this maybe?

$Excel_Path = 'C:\Program Files\Microsoft Office\Office12\Excel.exe'
$File_Name =  'D:\book1.xlsx'

$pid = Run($Excel_Path & ' "' & $File_Name & '"')

Do
    Sleep(10)
Until Not ProcessExists($pid)

... Here's the rest of your script once Excel closes ...

Share this post


Link to post
Share on other sites

Hi,

another way, jumping on cjconstatine's code, avoiding problems with run and blanks in path and filename:

$Excel_Path = 'C:\Program Files\Microsoft Office\Office12\Excel.exe'
$File_Name =  'D:\book1.xlsx'

ShellExecuteWait ($Excel_Path, $File_Name)

;-))

Stefan

Share this post


Link to post
Share on other sites

Thank you! That worked fine!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0