View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
RobH RobH is offline
external usenet poster
 
Posts: 13
Default Run-time error 9 when running add-in

I have successfully set up some code in my PERSONAL.XLS sheet, which
automatically runs a macro whenever a spreadsheet is opened. For the
purposes of rolling this out, we want to set it up as an add-in. When
I do this, the same code falls over with a run-time error 9.

When I go into debug, it goes into the class module I have set up.
The code in this module is below, and the if statement is highlighted
in debug.

Public WithEvents app As Application

Private Sub app_Workbookopen(ByVal Wb As Workbook)

If Wb.Windows(1).Visible = True Then
MsgBox ("True")
End If

End Sub

Does the syntax change if using an add-in rather than PERSONAL.XLS?
Any help would be appreciated.

Thanks,
Rob