Sunday, 15 September 2013

vba - Excel workbook only shows after running code is finished -


I have a program in the Excel workbook that opens a PowerPoint file, updates the link inside this file and After that it closes. It works fine here My problem is: When the link is updated, the excel file is opened from source data. This file opens after powerpoint is closed. I want to turn it off because I repeat this process for many files and I can not end up with hundreds of open Excel files.

I tried the following:

  WBKs = Application.Workbooks.count I = 1 for the WBK Step-1 If workbooks (i) .names & lt; & Gt; This workbook. Name then workbooks (i). Save switchheses: = Wrong end if next  

Now weird part comes when whenever I just run my code, WBK always gives 1 and Excel file only escalates after the code is over is. If I go through my code in debug mode, then it works as soon as I enter the debug mode, the workbook pops up.

I tried Applicatio.Wait Hope the file will appear after one second, only after the file is finished.

I tried while while loop to wait for the file to open. Excel crash because I never leave the loop.

Editing: I tried either do not work as the DoEvents .

This is just a workaround, but the X bar has run your macro . Store x in the workbook somewhere, save and kill the excel process (all examples, including oneself):

  String sKill = "Tasky / F / IM excel.exe "Shell S.Kill, vbHide  

found here:

The next time you run the macro, you can press x To update you will use the next ppt file as a starting point.


No comments:

Post a Comment