View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Workbook_Open problem

Try

Private Sub Workbook_Open()
With Application.ThisWorkbook.Windows(1)
.Width = 275
.Height = 270
End With
End Sub

--
Regards,
Tom Ogilvy


"TroyH" wrote in message
...
Why do I keep getting this error:

Run-time error '1004':
Unable to set the Width property of the Windows class

In my ThisWorkbook object I have the following code:

Private Sub Workbook_Open()
With ActiveWindow
.Width = 275
.Height = 270
End With
End Sub

This only errors out when I open Excel with the file. If Excel is already

open, no error.

The worksheet is not protected.

Thanks.