Jump to content

_Excel_BookOpen Function Hides existing book and opens the book specified in same window

Recommended Posts


Hello friends,

I am trying to create a GUI which opens a workbook in hidden mode and update the sheet with the data in the GUI. Everything works fine when no other excel workbook is open while running the program, but when any other workbook was open then the program closes the existing workbook and opens the specified workbook in the same window and although the visibility is set to HIDDEN the windows is visible. But the program updates the sheet and closes the workbook when it is done and reopens the previously open workbook again. But I want the program to not disrupt the open workbook . Please help me sort out this problem.

Find the piece of code I've used to open the workbook below. Quick help would be great since I have to complete it ASAP.

Func ExcelOpen()
$ExcelObj = _Excel_Open()
$ExcelObj.Visible = 0
If @error Then Exit MsgBox(0, "", 'Error creating object' & @CRLF & 'Error = ' & @error)
Global $ExcelLxn = IniRead(@ScriptDir & '\Settings\settings.ini', 'ExcelLocation', 'location', '')
$ExcelWB = _Excel_BookOpen($ExcelObj, $ExcelLxn)
If @error Then Exit MsgBox(0, "", 'Error opening Workbook' & @CRLF & 'Error = ' & @error)

Thanks in advance.

Share this post

Link to post
Share on other sites

@Subz Thank you so much. It worked.

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


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.