Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro - verify if excel file is already open

Hello

I have a macro that open a excel file to export there graphs.

set XLApp = CreateObject("Excel.Application")

set XLDOC = XLApp.Workbooks.Open ("C:\QV\360.xlsx")

I would like to knwo if possile to verify if the file is already open and not open it again.

this is what is happening now, macro open the file as read only.

I just need that macro will choose this file in case it's already open

thanks

4 Replies
Gysbert_Wassenaar

This is totally not related to qlikview so you might have more luck searching for an answer elsewhere. Perhaps this page helps: https://support.microsoft.com/en-us/kb/153058


talk is cheap, supply exceeds demand
asgardd2
Creator III
Creator III

You can check after the file is opened, and if necessary to close it.

sub test

set XLApp = CreateObject("Excel.Application")

set XLDOC = XLApp.Workbooks.Open ("C:\Tasks\1.xlsx")

IF XLApp.ActiveWorkbook.ReadOnly THEN

    MSGBOX "READ_ONLY MODE"
    XLApp.Quit 

END IF

end sub

Not applicable
Author

it's a macro in qlikview that open an excel file

Not applicable
Author

THANKS FOR YOUR HELP

GOOD IDEA