Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for Data Integration and Data Analytics gurus. Register Today
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
Highlighted
MVP & Luminary
MVP & Luminary

Re: Macro - verify if excel file is already open

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
Highlighted
Creator III
Creator III

Re: Macro - verify if excel file is already open

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

Highlighted
Not applicable

Re: Macro - verify if excel file is already open

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

Highlighted
Not applicable

Re: Macro - verify if excel file is already open

THANKS FOR YOUR HELP

GOOD IDEA