Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Syntax-Change?

Hi folks,
migrating from Excel 2000 to 2003, I realize that
the VBA-code may have changed in some parts.

The routine below, called when workbook
opens - quite helpful at times when a bit of
programming is done - in 2003 produces
an error:

Sub OpenMainWindow()
' On Error Resume Next
With Application.VBE.MainWindow
.Visible = True
.SetFocus
End With
End Sub

Is there any known workaround available?
Thanks in advance for any hint.

Best Regards
Peter Ostermann



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 196
Default Syntax-Change?

Hi Peter

Does it actually error out on a particular line in the sub you
posted? I ask because it causes no errors on my machine (xl2003 and
XP SP2). How are you calling that sub on opening of the workbook? Is
it a line in the WorkBook_Open event such as:

Private Sub Workbook_Open()
OpenMainWindow
End Sub

Best regards

Richard

On 27 Jan, 11:18, "Peter Ostermann"
wrote:
Hi folks,
migrating from Excel 2000 to 2003, I realize that
the VBA-code may have changed in some parts.

The routine below, called when workbook
opens - quite helpful at times when a bit of
programming is done - in 2003 produces
an error:

Sub OpenMainWindow()
' On Error Resume Next
With Application.VBE.MainWindow
.Visible = True
.SetFocus
End With
End Sub

Is there any known workaround available?
Thanks in advance for any hint.

Best Regards
Peter Ostermann


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Syntax-Change?

In one of my workbooks, I include a dummy sub called demo:

Sub demo()

End Sub

In ThisWorkbook code, I include:


Private Sub Workbook_Open()
Application.Goto "demo"
End Sub

This is enough to open the VBE and give it focus.
--
Gary's Student
gsnu200702


"Peter Ostermann" wrote:

Hi folks,
migrating from Excel 2000 to 2003, I realize that
the VBA-code may have changed in some parts.

The routine below, called when workbook
opens - quite helpful at times when a bit of
programming is done - in 2003 produces
an error:

Sub OpenMainWindow()
' On Error Resume Next
With Application.VBE.MainWindow
.Visible = True
.SetFocus
End With
End Sub

Is there any known workaround available?
Thanks in advance for any hint.

Best Regards
Peter Ostermann




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default Syntax-Change?

Put the same code in the workbook open macro

Private Sub Workbook_Open()
On Error Resume Next
With Application.VBE.MainWindow
.Visible = True
.SetFocus
End With

End Sub


"Peter Ostermann" wrote:

Hi folks,
migrating from Excel 2000 to 2003, I realize that
the VBA-code may have changed in some parts.

The routine below, called when workbook
opens - quite helpful at times when a bit of
programming is done - in 2003 produces
an error:

Sub OpenMainWindow()
' On Error Resume Next
With Application.VBE.MainWindow
.Visible = True
.SetFocus
End With
End Sub

Is there any known workaround available?
Thanks in advance for any hint.

Best Regards
Peter Ostermann




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Syntax-Change?

Gotcha!

Hi fellows,

thanks for your hints.
In the meantime I found the solution which
I like to share with you.

Since I have the German edition, my translation
may be wrong, but I will try:

tools- macros - security - registertab: "trustable publishers"
There just hook the rectangle: trust access to visual basic project

Best Regards
Peter Ostermann


The routine below, called when workbook
opens - quite helpful at times when a bit of
programming is done - in 2003 produces
an error:

Sub OpenMainWindow()
' On Error Resume Next
With Application.VBE.MainWindow
.Visible = True
.SetFocus
End With
End Sub

Is there any known workaround available?
Thanks in advance for any hint.

Best Regards
Peter Ostermann







Reply
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
VBA syntax dhstein Excel Discussion (Misc queries) 3 March 13th 09 12:53 PM
Excel: Syntax to change cell color based on color of another cell davew18 Excel Worksheet Functions 1 January 4th 07 01:24 PM
syntax for relative cell change and looping BwanaP Excel Programming 1 September 27th 03 03:36 PM
Change hard code to Variable syntax Orlando Magalhães Filho Excel Programming 1 September 13th 03 07:36 AM
Change hard code to Variable syntax Bob Phillips[_5_] Excel Programming 0 September 13th 03 07:32 AM


All times are GMT +1. The time now is 11:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"