LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 345
Default Run time error, Open event, Wbk is Read Only

Hi All,
The function below resides in an Add-In.
It runs as part of a macro executed at the open event.

The open event code is: Call Wbk_Open(Status)
The Wbk_Open sub is also in the addin and uses the function.

All is well when the wbk opened after the personal.xls is NOT read only.
All is well when the read only wbk is opened after a 'regular' wbk.
I get the 1004 run time error at the set line noted below when the 1st wbk
opened after the personal is a backup wbk opened as read only.

I've stepped thru the code and all variables seem to have good values.
MsoMaxRow is a public constant in Declarations in the AddIn.
The read only wbk and the one from which is was created both reference the
Add IN.

I don't know where to go from here.
Thanks.


Function zFind_Row1Cf(Ws As Worksheet, sLookFor As String, _
Col As Integer, FmRow As Long, ToRow As Long, _
bXlWhole As Boolean) As Long
'Return the row of the cell where a string value is found in one column.
'Zero returned if not found. bXlwhole= true= string occupies entire cell.
Dim It As Range, WhoOrPrt

If bXlWhole = True Then WhoOrPrt = xlWhole Else WhoOrPrt = xlPart
If FmRow < 1 Then FmRow = 1
If ToRow < 1 Or ToRow MSoMaxRow Then ToRow = MSoMaxRow

'the set gets the run time error and shows 'yellow'
Set It = Ws.Range(Cells(FmRow, Col), Cells(ToRow, Col)).Find(sLookFor, _
LookIn:=xlValues, LookAt:=WhoOrPrt)

If Not It Is Nothing Then zFind_Row1Cf = It.Row
End Function
--
Neal Z
 
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
immediately closes when I try to open, error; can't save as, read Kris Excel Discussion (Misc queries) 0 August 3rd 08 04:05 PM
Workbook_Open event not called when workbook forced to re-open in read-only mode. Chrisso Excel Programming 2 May 15th 07 03:44 PM
i cannot open excel file error Cannot access read-only document me Lenda. Excel Worksheet Functions 1 March 14th 05 06:15 PM
Error boxes when opening Excel "unable to read file" then "open X. jppz Setting up and Configuration of Excel 1 February 19th 05 03:51 AM
Open file to write and read at the same time Tom Ogilvy Excel Programming 2 September 22nd 03 01:10 PM


All times are GMT +1. The time now is 06:12 PM.

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

About Us

"It's about Microsoft Excel"