Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error on opening more than one workbook containing the same code

Excel 2002 SP-2

I have a series of workbooks that contain identical code. This
includes formatting of a worksheet area which is triggered on opening
the workbook:

Private Sub Workbook_Open()

'---------------------'
'Name the 'Base' range'
'---------------------'
ThisWorkbook.Names.Add Name:="Base", _
RefersTo:="=Sheet1!$A$21", Visible:=True

Call SetupTemplateArea

.....


Sub SetupTemplateArea()

Dim mysheet As Worksheet

Set mysheet = ThisWorkbook.Worksheets("Sheet1")

'Define and format the template work area
mysheet.Range(Range("Base").Offset(0, 0), Range("Base").Offset(5,
8)).Name = "TEMPLATE_AREA"


If I open more than one workbook from the same Open dialog box then the
code fails at the line above for all workbooks, except for the last
which opens normally after the code in each of the other workbooks is
reset. The error is Run-time error '1004': Method 'Range' of object
'_Worksheet' failed.

The workbooks behave normally when opened individually.

Any help would be appreciated.

Kind regards,
John

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error code while opening a workbook [email protected] Excel Programming 0 November 28th 05 01:27 PM
run code on opening workbook and apply code to certain sheets Jane Excel Programming 7 August 8th 05 09:15 AM
Error in code opening Outlook muziq2[_17_] Excel Programming 2 July 14th 04 05:09 AM
Performing code without opening the Workbook Marishah Warren Excel Programming 2 December 25th 03 10:04 AM
Code for Opening a Closed Workbook scrabtree23[_2_] Excel Programming 3 November 11th 03 03:48 PM


All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"