Jump to content

to close particular excel from the group of opened excels


amb2301
 Share

Recommended Posts

Link to comment
Share on other sites

Link to comment
Share on other sites

@Nine The only way I can replicate the issue is if Excel is opened with one set of credentials and AutoIt script is run with different credentials, so thought running the example script first would verify if that is the issue.  If amb2301 doesn't get any results with that I would normally try running the script on a new profile and see if it works (just in case it's profile related issue).  If that fails then reinstalling Office is probably the way to go.

Link to comment
Share on other sites

13 hours ago, Subz said:

In the help file can you navigate to _Excel_BookList.htm and Open the script and run the script and let us know the results?  If you still don't see anything can you add #RequireAdmin to the top of the script and run that and let us know the results?

Hi Subz, 

As suggested, i run the below code in my system, by creating a folder called Extras & 2 excel files inside of it, the code was working fine, it opened both the excels & i got the below screen...

image.png.9e2fa943e2e695f7c929d79516ce7562.png

#include <Array.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Create two instances of Excel and open two workbooks
Local $sWorkbook1 = @ScriptDir & "\Extras\_Excel1.xls", $sWorkbook2 = @ScriptDir & "\Extras\_Excel2.xls"
Local $oExcel1 = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookList Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook1 = _Excel_BookOpen($oExcel1, $sWorkbook1)
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookList Example", "Error opening workbook '" & $sWorkbook1 & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_Close($oExcel1)
    Exit
EndIf
Local $oExcel2 = _Excel_Open(Default, Default, Default, Default, True)
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookList Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $oWorkbook2 = _Excel_BookOpen($oExcel2, $sWorkbook2)
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookList Example", "Error opening workbook '" & $sWorkbook1 & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_Close($oExcel1)
    _Excel_Close($oExcel2)
    Exit
EndIf

; Display a list of all workbooks of all Excel instances
Local $aWorkBooks = _Excel_BookList()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookList Example 2", "Error listing Workbooks." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
_ArrayDisplay($aWorkBooks, "Excel UDF: _Excel_BookList Example 2 - List of workbooks of all instances")

 

Link to comment
Share on other sites

  • 3 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...