Ignore the 'file in use message' when opening Excel

  • Thread starter Michiel via OfficeKB.com
  • Start date
M

Michiel via OfficeKB.com

Hi all,

I am scheduling an Excel workbook using the Scheduler Tool of Windows.
It just calls an Excel workbook, which opens, does some autorun processing
and closes again.

This works well, except when I have excel already open. In that case another
instance of Excel is opened (by the scheduler) and I get the "File in Use"
popup stateing that my PERSONAL.XLS is locked for editing. And gives me a
chance to cancel (button). A logical thing but unhandy in this context.

Is there a way to ignore this message or to add an extra parameter to the
call of the worksheet to prevent the message, or to automatically apply
cancel?

Thanks!

M.
 
K

ker_01

Within Excel I'd use:

Application.DisplayAlerts = False
'code to open the workbook
Application.DisplayAlerts =True

in the scheduler, are you running this as a .vbs file? If so, consider
something like (untested):
Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts=False
Set objWorkbook = objExcel.Workbooks.Open("C:\path\filename.xls")
objExcel.DisplayAlerts=True
objExcel.Run "MacroName"
objExcel.ActiveWorkbook.Save
objExcel.ActiveWorkbook.Close(0)
objExcel.Quit

If that doesn't help, consider posting your code where you instantiate
Excel, that might help draw more answers.

Keith
 
M

Michiel via OfficeKB.com

Hi Keith,

Thanks for your answer.
Unfortunately this will not work here.
The message that Excel finds the personal.xls being blocked "event" occurs
even before the code is kicksin. So, even when I did this the popup keeps on
appearing.

M.
 
M

Michiel via OfficeKB.com

Additional,

Keith, triggered by your VBS question/suggestion I tried to start Excel via
VBS instead of directly calling the xls file, and that did do the trick.

Once more: Thanks for your help!

M.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top