![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Andy Devine
Posts: 106
|
hi
i'm using a macro to open up each of our account managers workbooks and then copy-paste them into one giant workbook so that the system administrator can compile a report (we've found is better than sharing one workbook) To ensure system administrator is NOT opening a workbook that already open, i've put in code (see example below)...this means that when macro tries to save a read only version it fails and on error goes to a sheet which contains message .."workbook already open..do this...etc, etc" QUESTION: this macro can take a long time to run if there are a few workbooks to open and espicially as each workbook is saved after it is opened...is there a better way of doing this? Thanks Andy (sorry is so long winded..) On Error GoTo Error1 Workbooks.Open Filename:= _ "M:AccMan1.xls", Password:="123" ActiveWorkbook.Save Exit Sub Error_1: Windows("XYZ.xls").Activate Sheets("Error").Select End Sub
__________________
Andy Devine |
|
|
|
|
|
#2 |
|
New Member
Join Date: Apr 2002
Posts: 41
|
Andy
Try using: Ff ActiveWorkbook.ReadOnly = True then etc As a though, you could also bypass open workbooks by recording the name and then closing any readonly workbooks. You could then loop the code (or run it again) to return to them later. Any help? Ragards Robb__ |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|