Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB editor opens by magic


Hi there,
After the VB lines of code (ran in Excel)


Bla bla bla
'/*/*/*/*/*/*/*/*/*/*/*/*/
'Insert a proc into Sheet1
'/*/*/*/*/*/*/*/*/*/*/*/*/
Dim Startline As Long
With ActiveWorkbook.VBProject.VBComponents("Sheet1").Co deModule
Startline = .CreateEventProc("Change", "Worksheet") + 2
..InsertLines Startline, "call Update_residuals"
End With
End If
retest = False
Workbooks(glbMainTrialFileName & ".xls").Save
Unload Me
Exit Sub


the VB editor opens by magic ?
could anybody tell me why ?

Dallag


--
dallag
------------------------------------------------------------------------
dallag's Profile: http://www.excelforum.com/member.php...o&userid=29762
View this thread: http://www.excelforum.com/showthread...hreadid=494813

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VB editor opens by magic

That's just the way VBA is -- it opens the editor when you modify
a code module. Annoying, isn't it? You can write code to close
the window.

Application.VBE.MainWindow.Visible = False

You'll still get a flicker, but the window will close.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"dallag"
wrote in message
...

Hi there,
After the VB lines of code (ran in Excel)


Bla bla bla
'/*/*/*/*/*/*/*/*/*/*/*/*/
'Insert a proc into Sheet1
'/*/*/*/*/*/*/*/*/*/*/*/*/
Dim Startline As Long
With ActiveWorkbook.VBProject.VBComponents("Sheet1").Co deModule
Startline = .CreateEventProc("Change", "Worksheet") + 2
InsertLines Startline, "call Update_residuals"
End With
End If
retest = False
Workbooks(glbMainTrialFileName & ".xls").Save
Unload Me
Exit Sub


the VB editor opens by magic ?
could anybody tell me why ?

Dallag


--
dallag
------------------------------------------------------------------------
dallag's Profile:
http://www.excelforum.com/member.php...o&userid=29762
View this thread:
http://www.excelforum.com/showthread...hreadid=494813



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default VB editor opens by magic

Abra-Cadabra:

I got a compile error when I inserted your example code in the Workbook_Open
sub, closed and re-opened Excel. That caused the VB editor to automatically
open. The error was "End If without block If". Where is your "If" statement?

"dallag" wrote:


Hi there,
After the VB lines of code (ran in Excel)


Bla bla bla
'/*/*/*/*/*/*/*/*/*/*/*/*/
'Insert a proc into Sheet1
'/*/*/*/*/*/*/*/*/*/*/*/*/
Dim Startline As Long
With ActiveWorkbook.VBProject.VBComponents("Sheet1").Co deModule
Startline = .CreateEventProc("Change", "Worksheet") + 2
.InsertLines Startline, "call Update_residuals"
End With
End If
retest = False
Workbooks(glbMainTrialFileName & ".xls").Save
Unload Me
Exit Sub


the VB editor opens by magic ?
could anybody tell me why ?

Dallag


--
dallag
------------------------------------------------------------------------
dallag's Profile: http://www.excelforum.com/member.php...o&userid=29762
View this thread: http://www.excelforum.com/showthread...hreadid=494813


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VB editor opens by magic


Thanks for your help fellas.
Abra-cadabra, sorry but the code was just a snap shot abd did not
include everything.
Thanks.


--
dallag
------------------------------------------------------------------------
dallag's Profile: http://www.excelforum.com/member.php...o&userid=29762
View this thread: http://www.excelforum.com/showthread...hreadid=494813

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default VB editor opens by magic

Try this codes, which will not open VB Editor.

Sub test()
With ThisWorkbook.VBProject.VBComponents("sheet1").Code Module
..InsertLines 1, "Private Sub Worksheet_Change(ByVal Target As Range)"
..InsertLines 2, "call Update_residuals"
..InsertLines 3, "End Sub"
End With
End Sub

Regards,
Shah Shailesh
http://in.geocities.com/shahshaileshs/
(Excel Add-ins Page)

*** Sent via Developersdex http://www.developersdex.com ***
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
Visual Basic Editor opens bi itself KG Excel Discussion (Misc queries) 0 September 15th 07 04:02 PM
VBA Editor opens automatically after unlocking machine JB2010 Excel Discussion (Misc queries) 1 March 12th 07 05:20 PM
Computer Lock opens up VB editor Phaedrus Excel Programming 2 December 6th 05 12:45 AM
Textbox Hyperlink opens VB Editor at Specific Module Neily[_3_] Excel Programming 0 October 26th 05 12:04 PM
VBA Editor opens by itself? Ed[_18_] Excel Programming 0 May 11th 04 05:29 PM


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