If you are using Excel 97 then you must change the takefocusonclick property to
false off the Control toolbox button.
It is a bug in 97
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl
"Nathaniel" wrote in message ...
I have assigned my macro to a command button it fails to
run. It gives run time error 1004. When I run the macro
alone using ALT F8 run macro it runs without giving any
errors.
Below is the sample macro and position where error occurs
Public f_name as variant
Public wkbBook as variant
Sub CommandButton1_Click()
f_name = Application _
.GetOpenFilename("Text Files (*.txt), *.txt")
If f_name < False Then
MsgBox "Opening Raw Data Text File " & f_name
End If
'Opening Raw Data File
Workbooks.OpenText Filename:=f_name, Origin:= _
xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:=Array(Array(0, _
2), Array(17, 2), Array(30, 2), Array(39, 2))
Set wkbBook = ActiveWorkbook
Nortel wkbBook
End Sub
Sub Nortel(ByRef wkbBook As Workbook)
wkbBook.Activate
'To search for requires information
il = 1
Do While Cells(il, 1) < "CLASS: MONDAY" 'Run time
error occurs here
il = il + 1
Loop
End sub