ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro Skip workbook (https://www.excelbanter.com/excel-worksheet-functions/175948-macro-skip-workbook.html)

[email protected]

Macro Skip workbook
 
I have created some vb to open another work book but if it is open it
goes to debug
anyone have a skip if open script

cheers

jack

Dave Peterson

Macro Skip workbook
 
dim wkbk as workbook
on error resume next
set wkbk = workbooks("book1.xls") '<- no drive, no path, just filename
on error goto 0

if wkbk is nothing then
'open it, with drive, path, filename
set wkbk = workbooks.open(filename:="c:\folder\folder\book1.x ls")
end if



wrote:

I have created some vb to open another work book but if it is open it
goes to debug
anyone have a skip if open script

cheers

jack


--

Dave Peterson


All times are GMT +1. The time now is 05:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com