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: 9
Default Error in VB Editor Coding

Hi

I have used the code below to close the extra VB windows that end up
being open when using the VBA editor.

Sub CloseVBEWindows()
Dim W As VBIDE.Window

ThisWorkbook.VBProject.VBE.MainWindow.SetFocus
For Each W In Application.VBE.Windows
If W.Type = vbext_wt_CodeWindow Or W.Type = vbext_wt_Designer Then
If Application.VBE.ActiveWindow.Caption < W.Caption Then
W.Close
End If
End If
Next W
End Sub

It works fine on a 64-bit laptop running Windows 10 and Excel 2010.
When I run it on a 64-bit laptop with windows 7 and Excel Professional
Plus I get the error 424 (object required) at the following line:
If W.Type = vbext_wt_CodeWindow Or W.Type = vbext_wt_Designer Then

The extensibility library 5.3 has been set in references.

Can anyone suggest a possible solution, please

Many thanks

Tim


 
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
Error 400 in VB editor Howard Excel Programming 3 September 1st 12 06:24 AM
on error coding Matthew Dyer Excel Programming 2 November 12th 09 12:16 AM
CODING ERRor N.F[_2_] Excel Discussion (Misc queries) 1 June 27th 07 09:02 PM
Help with coding error carlos Excel Programming 3 June 5th 06 11:42 AM
coding error tom mcdonald Excel Programming 2 June 16th 05 04:04 PM


All times are GMT +1. The time now is 02:44 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"