excel - Why do I need to have the VBA editor window open for my macro to work? -


i have excel file in vba macro loads data userform.

the macro never crashes if first open visual basic editor (by clicking developer -> visual basic), crash , close excel if run without editor open.

it's though opening vba editor activates macro , enables work properly.

i'm trying narrow in on why case , how fix file don't need first open editor. ideas?

edit: don't understand why i'm being downvoted.

sample code macro:

public sub loadbutton_click()        'policy information       zonelatitudetextbox.text = sheets("saved policy values").cells(2, 2)       zonelongitudetextbox.text = sheets("saved policy values").cells(3, 2)       townclasscombobox.text = sheets("saved policy values").cells(4, 2)   

this thread provided me answer question:

http://www.xtremevbtalk.com/excel/229325-excel-crashes-unless-vba-editor.html

apparently excel runs memory issues when there userform has many controls. opening vba editor somehow bypasses memory issues , allows associated macro run properly.

to automate process, 1 has add following lines of code beginning of macro:

application.vbe.mainwindow.visible = true
application.vbe.mainwindow.visible = false


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -