ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   open file with code (https://www.excelbanter.com/excel-discussion-misc-queries/228839-open-file-code.html)

Steve

open file with code
 
Seems as though if I open a workbook using Workbooks.Open(Filename:=xxx) and
the file is in use I don't get the "file in use" dialog. I want to know if
I'm opening a read only copy. Any workaround?

kassie

open file with code
 
I open files as follows:

varDir = CurDir()
On Error GoTo Opened
Set wSource = Worksheets("----")
Workbooks.Open (varDir & "\----.xls"), _
Notify = False, ReadOnly = False
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Heading
Exit Sub
Opened:
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Your code here, I use a sub name here, to go to the next stage. So if
the next stepis maybe the insertion of headings, which is done with Sub
Headings(), I would put Headings here.


--
HTH

Kassie

Replace xxx with hotmail


"Steve" wrote:

Seems as though if I open a workbook using Workbooks.Open(Filename:=xxx) and
the file is in use I don't get the "file in use" dialog. I want to know if
I'm opening a read only copy. Any workaround?



All times are GMT +1. The time now is 08:19 PM.

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