Working with Excel.Application interferring with Excel work

bejhan
bejhan used Ask the Experts™
on
I modify some excel files programatically through MS access using the Excel.Application object.

I am finding that this is interferring with the user's excel work. Is there anyway I can stop this interference.

Here is a sample of some things I do to an excel file.
Dim excApplication As Excel.Application

    Set excApplication = CreateObject("Excel.Application")
    excApplication.Workbooks.Open strQueryPath
    
    With excApplication.Application
        .Sheets(strSheetName).Select
                            
        .Rows("1:1").Select
        With .Selection
            .Font.Bold = True
        End With
        
        .Columns("K:K").Select
        With .Selection
            .NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_)"
        End With

        .Cells.EntireColumn.AutoFit
        
        .Sheets(strSheetName).Name = strNewSheetName
    End With
    
    excApplication.Application.ActiveWorkbook.Save
    excApplication.Quit
    Set excApplication = Nothing

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
What do you mean by "interfering"? If you mean that you automating the same file as an Excel user, then I would presume this would cause issues with that workbook.

Author

Commented:
My application is producing and manipulating hundreds of files which takes 20-30 minutes, during this time if I try to do any of the following with excel files (not being used by the program) interference occurs:
1. Open an excel file sometimes => I cannot open it.
2. Open an excel file sometimes => it is closed right away.
3. Open an excel file and close it quickly sometimes => Messed up application execution (can't find the sheet it was working on).
If you are going to manipulate the Excel files with another program, it should be at a time when now users will be trying to do the same.  

Author

Commented:
But I thought the Excel.Application in MS Access represents an EXCEL.EXE process. So shouldn't the user's own interaction with excel be in a separate EXCEL.EXE process and not have any interference?
Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014
Commented:
All instances of Excel would share the same dependent objects. Excel is not a single, monolithic program. It is comprised of many separate (and dependent) objects, and each instance of Excel would need to work with those objects.

Author

Commented:
That makes sense. I guess I'll just have to tell the user not to use excel while the application is processing.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial