Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
immediately closes when I try to open, error; can't save as, read | Excel Discussion (Misc queries) | |||
Workbook_Open event not called when workbook forced to re-open in read-only mode. | Excel Programming | |||
i cannot open excel file error Cannot access read-only document me | Excel Worksheet Functions | |||
Error boxes when opening Excel "unable to read file" then "open X. | Setting up and Configuration of Excel | |||
Open file to write and read at the same time | Excel Programming |