VBA just dies - EXCEL 97

I have a button on the first of 30 worksheets which does a lot of work
behind the scenes: deleting worksheets, populating cells, creating new
worksheets.

Most of the time, but not frequently enough, it runs flawlessly.

But every once in a while it will start the process, delete all the
worksheets it is supposed to delete, create a lot of the sheets it is
supposed to create and then, near the end of the process, before it
has completed 100% of the sheets it is supposed to create, it just
stops dead in its tracks.  In order to recover I have to go into VBA
(alt-11) and enter a "application.screenupdating = true" command into
the immediate window.

However, while the above gives me access to my excel workbooks again,
the button will now continually fail until I close all open workbooks,
completely exit excel and fire everything back up again.

Since I routinely have 10 or more workbooks open at once, I'd really
like to figure out a way for me to be able to run the routines
associated with the command button again without having to restart
Excel.

Yes, I have tried just shutting down the offending workbook and
calling it up again.  No go.  In fact, I've closed down all workbooks
and called up the offending workbook and it still fails.  Only
restarting Excel seems to work.

Any idea how to go about testing this?

Thanks.
0
dranon (82)
10/2/2009 6:16:32 AM
excel 39879 articles. 2 followers. Follow

6 Replies
520 Views

Similar Articles

[PageSpeed] 17

On Thu, 01 Oct 2009 23:16:32 -0700, dranon <dranon@dranon.invalid.net>
wrote:

>I have a button on the first of 30 worksheets which does a lot of work
>behind the scenes: deleting worksheets, populating cells, creating new
>worksheets.
>
>Most of the time, but not frequently enough, it runs flawlessly.
>
>But every once in a while it will start the process, delete all the
>worksheets it is supposed to delete, create a lot of the sheets it is
>supposed to create and then, near the end of the process, before it
>has completed 100% of the sheets it is supposed to create, it just
>stops dead in its tracks.  In order to recover I have to go into VBA
>(alt-11) and enter a "application.screenupdating = true" command into
>the immediate window.
>
>However, while the above gives me access to my excel workbooks again,
>the button will now continually fail until I close all open workbooks,
>completely exit excel and fire everything back up again.

When I say it fails, it fails the same way as the first failure: it
deletes and creates most of the worksheets and then it just dies.  I
didn't mean to say that the button doesn't do anything.  It does.  And
all my message boxes run properly, too.

>Since I routinely have 10 or more workbooks open at once, I'd really
>like to figure out a way for me to be able to run the routines
>associated with the command button again without having to restart
>Excel.
>
>Yes, I have tried just shutting down the offending workbook and
>calling it up again.  No go.  In fact, I've closed down all workbooks
>and called up the offending workbook and it still fails.  Only
>restarting Excel seems to work.
>
>Any idea how to go about testing this?
>
>Thanks.

0
dranon (82)
10/2/2009 7:27:00 AM
There is a limit of 64KB in a single module. Copy the procedures into Notepad 
and save the file. If Notepad file is this big then in the Visual basic 
Editor, declare each Sub as Public, e.g. Public Sub MyTest() and copy some 
procedures into a new module.

Modules exceeding the 64KB limit tend to be unstable.

Maybe someone more proficient can give better suggestions.

HTH Peter A

"dranon" wrote:

> On Thu, 01 Oct 2009 23:16:32 -0700, dranon <dranon@dranon.invalid.net>
> wrote:
> 
> >I have a button on the first of 30 worksheets which does a lot of work
> >behind the scenes: deleting worksheets, populating cells, creating new
> >worksheets.
> >
> >Most of the time, but not frequently enough, it runs flawlessly.
> >
> >But every once in a while it will start the process, delete all the
> >worksheets it is supposed to delete, create a lot of the sheets it is
> >supposed to create and then, near the end of the process, before it
> >has completed 100% of the sheets it is supposed to create, it just
> >stops dead in its tracks.  In order to recover I have to go into VBA
> >(alt-11) and enter a "application.screenupdating = true" command into
> >the immediate window.
> >
> >However, while the above gives me access to my excel workbooks again,
> >the button will now continually fail until I close all open workbooks,
> >completely exit excel and fire everything back up again.
> 
> When I say it fails, it fails the same way as the first failure: it
> deletes and creates most of the worksheets and then it just dies.  I
> didn't mean to say that the button doesn't do anything.  It does.  And
> all my message boxes run properly, too.
> 
> >Since I routinely have 10 or more workbooks open at once, I'd really
> >like to figure out a way for me to be able to run the routines
> >associated with the command button again without having to restart
> >Excel.
> >
> >Yes, I have tried just shutting down the offending workbook and
> >calling it up again.  No go.  In fact, I've closed down all workbooks
> >and called up the offending workbook and it still fails.  Only
> >restarting Excel seems to work.
> >
> >Any idea how to go about testing this?
> >
> >Thanks.
> 
> 
0
BillyLiddel (193)
10/2/2009 8:19:03 PM
Thanks for the reply, Billy.

The code, although it does a lot of work, is pretty tightly written
and has a very small footprint.

Anybody else have any ideas?

On Fri, 2 Oct 2009 13:19:03 -0700, Billy Liddel
<BillyLiddel@discussions.microsoft.com> wrote:

>There is a limit of 64KB in a single module. Copy the procedures into Notepad 
>and save the file. If Notepad file is this big then in the Visual basic 
>Editor, declare each Sub as Public, e.g. Public Sub MyTest() and copy some 
>procedures into a new module.
>
>Modules exceeding the 64KB limit tend to be unstable.
>
>Maybe someone more proficient can give better suggestions.
>
>HTH Peter A
>
>"dranon" wrote:
>
>> On Thu, 01 Oct 2009 23:16:32 -0700, dranon <dranon@dranon.invalid.net>
>> wrote:
>> 
>> >I have a button on the first of 30 worksheets which does a lot of work
>> >behind the scenes: deleting worksheets, populating cells, creating new
>> >worksheets.
>> >
>> >Most of the time, but not frequently enough, it runs flawlessly.
>> >
>> >But every once in a while it will start the process, delete all the
>> >worksheets it is supposed to delete, create a lot of the sheets it is
>> >supposed to create and then, near the end of the process, before it
>> >has completed 100% of the sheets it is supposed to create, it just
>> >stops dead in its tracks.  In order to recover I have to go into VBA
>> >(alt-11) and enter a "application.screenupdating = true" command into
>> >the immediate window.
>> >
>> >However, while the above gives me access to my excel workbooks again,
>> >the button will now continually fail until I close all open workbooks,
>> >completely exit excel and fire everything back up again.
>> 
>> When I say it fails, it fails the same way as the first failure: it
>> deletes and creates most of the worksheets and then it just dies.  I
>> didn't mean to say that the button doesn't do anything.  It does.  And
>> all my message boxes run properly, too.
>> 
>> >Since I routinely have 10 or more workbooks open at once, I'd really
>> >like to figure out a way for me to be able to run the routines
>> >associated with the command button again without having to restart
>> >Excel.
>> >
>> >Yes, I have tried just shutting down the offending workbook and
>> >calling it up again.  No go.  In fact, I've closed down all workbooks
>> >and called up the offending workbook and it still fails.  Only
>> >restarting Excel seems to work.
>> >
>> >Any idea how to go about testing this?
>> >
>> >Thanks.
>> 
>> 

0
dranon (82)
10/3/2009 2:04:56 AM
Anybody?

On Fri, 02 Oct 2009 19:04:56 -0700, dranon <dranon@dranon.invalid.net>
wrote:

>Thanks for the reply, Billy.
>
>The code, although it does a lot of work, is pretty tightly written
>and has a very small footprint.
>
>Anybody else have any ideas?
>
>On Fri, 2 Oct 2009 13:19:03 -0700, Billy Liddel
><BillyLiddel@discussions.microsoft.com> wrote:
>
>>There is a limit of 64KB in a single module. Copy the procedures into Notepad 
>>and save the file. If Notepad file is this big then in the Visual basic 
>>Editor, declare each Sub as Public, e.g. Public Sub MyTest() and copy some 
>>procedures into a new module.
>>
>>Modules exceeding the 64KB limit tend to be unstable.
>>
>>Maybe someone more proficient can give better suggestions.
>>
>>HTH Peter A
>>
>>"dranon" wrote:
>>
>>> On Thu, 01 Oct 2009 23:16:32 -0700, dranon <dranon@dranon.invalid.net>
>>> wrote:
>>> 
>>> >I have a button on the first of 30 worksheets which does a lot of work
>>> >behind the scenes: deleting worksheets, populating cells, creating new
>>> >worksheets.
>>> >
>>> >Most of the time, but not frequently enough, it runs flawlessly.
>>> >
>>> >But every once in a while it will start the process, delete all the
>>> >worksheets it is supposed to delete, create a lot of the sheets it is
>>> >supposed to create and then, near the end of the process, before it
>>> >has completed 100% of the sheets it is supposed to create, it just
>>> >stops dead in its tracks.  In order to recover I have to go into VBA
>>> >(alt-11) and enter a "application.screenupdating = true" command into
>>> >the immediate window.
>>> >
>>> >However, while the above gives me access to my excel workbooks again,
>>> >the button will now continually fail until I close all open workbooks,
>>> >completely exit excel and fire everything back up again.
>>> 
>>> When I say it fails, it fails the same way as the first failure: it
>>> deletes and creates most of the worksheets and then it just dies.  I
>>> didn't mean to say that the button doesn't do anything.  It does.  And
>>> all my message boxes run properly, too.
>>> 
>>> >Since I routinely have 10 or more workbooks open at once, I'd really
>>> >like to figure out a way for me to be able to run the routines
>>> >associated with the command button again without having to restart
>>> >Excel.
>>> >
>>> >Yes, I have tried just shutting down the offending workbook and
>>> >calling it up again.  No go.  In fact, I've closed down all workbooks
>>> >and called up the offending workbook and it still fails.  Only
>>> >restarting Excel seems to work.
>>> >
>>> >Any idea how to go about testing this?
>>> >
>>> >Thanks.
>>> 
>>> 

0
dranon (82)
10/4/2009 11:04:41 PM
On Oct 4, 4:04=A0pm, dranon <dra...@dranon.invalid.net> wrote:
> Anybody?
>

I'm definitely not an expert, but I might qualify as "anybody"!

Have you checked to see if the code always fails at one certain
command, or within one specific routine?
Have you allowed Excel and your computer enough time to process
everything that's happening?
Do you have another process that's jumping in and hogging memory?
Have you tried things like clearing the Undo list and maybe throwing
in the screen updating, since that seems to help?
Maybe a few Do Events or Sleep to let the computer catch up to Excel?

I'm also adding the Excel.Programming group to this - you'd probably
get better answers there.

Ed
0
prof_ofwhat (194)
10/6/2009 4:40:19 PM
Prob'ly ought to add the rest of the original post to this:

http://groups.google.com/group/microsoft.public.excel/browse_thread/thread/=
b06f5592c181d1e1#


On Oct 6, 9:40=A0am, Ed from AZ <prof_ofw...@yahoo.com> wrote:
> On Oct 4, 4:04=A0pm, dranon <dra...@dranon.invalid.net> wrote:
>
> > Anybody?
>
> I'm definitely not an expert, but I might qualify as "anybody"!
>
> Have you checked to see if the code always fails at one certain
> command, or within one specific routine?
> Have you allowed Excel and your computer enough time to process
> everything that's happening?
> Do you have another process that's jumping in and hogging memory?
> Have you tried things like clearing the Undo list and maybe throwing
> in the screen updating, since that seems to help?
> Maybe a few Do Events or Sleep to let the computer catch up to Excel?
>
> I'm also adding the Excel.Programming group to this - you'd probably
> get better answers there.
>
> Ed

0
prof_ofwhat (194)
10/6/2009 6:55:58 PM
Reply:

Similar Artilces:

VBA code to say Yes or No if any VBA code is present in ActiveWork
Using XL 2003 & 97 Would like hit Ctrl+Shift+V and have an answer either yes or no as to the presence of Any VBA code in the Active Workbook. I do know that about the VBA editor/Explorer or to press the Run Macro button and get a list from various sources . I would like to stay at the keyboard and process a series of macros including one to let me know if I even need to evoke the VBA explorer. TIA Dennis There is no bootstrap macro to tell you whether you have macros or not. If there were there would be no limit to virus writers. --- HTH, David McRitchie, Microsoft MVP - Excel ...

VBA and Scheduled task in Outlook
Hi, how can I: a) pull the query from somewhere and send it by e-mail automatically. E.g. I want to take a temperature table from http://www.wunderground.com/history/airport/EHAM/2009/7/10/DailyHistory.html?req_city=NA&req_state=NA&req_statename=NA where 2009/7/10 is the date of yesterday put it into an e-mail and send it automatically each day at 8 o'clock? b) if this is not possible, how can I send an e-mail with the attachment c:\Documents\query20090710.xls each day at 8 o'clock? my boss wants this automatized, I know how to write the VBA code for Excel, but don'...

just browse in IE?
If there have ways browse news in outlook and not open browser? thanks.It is my joy if you can write back in chinese. aquajamy@126.com, you wrote on 4 Sep 2005 04:10:44 -0700: > If there have ways browse news in outlook and not open browser? > thanks.It is my joy if you can write back in chinese. Not in Outlook but in Outlook Express! There are many sites in www which describes using OE for news. Search for it! > It is my joy if you can write back in chinese Chinese? Oh my god! This language is much to difficult to learn it ;-)! Best Regards Christian Goeller -- Some mi...

Print, Merged Cells, and VBA
Hello I'm looking for a code that will help me with a print job for a worksheet. There are a lot of merged cells and a lot of "IF"s to be used in the VBA for range selection. Thanks in advance, Sarr ...

VLOOKUP in VBA
On the worksheet I can insert in a cell =VLOOKUP(C5, Hobokee.xls!AcsLow, 2) and it works perfectly, looks up the value in column 2 of the range named AcsLow in the same workbook. But elswhere I want in a macro to lookup the same table and assign the result to a variable BalAmt. BalAmt = VLOOKUP(AccNum, Hobokee.xls!AcsLow, 2) does not work. It gives a function not defined error on Hobokee. If instead of Hobokee I put Workbooks("Hobokee"), it gives function not defined error for VLOOKUP which it changes to VLookup. I have been overVLOOKUP in the Help file and see nothing wrong. W...

vba select field
Hi, having a button on a form, is it possible to select only some fields (all from the same table) of the current record instead of all fields? I've tried this code: RunCommand acCmdSelectRecord RunCommand acCmdCopy Forse dipende dei dati nel record. but it selects ALL fields in the form. Thank you. Remigio hi, On 10.04.2010 18:01, remigio wrote: > having a button on a form, is it possible to select only some fields > (all from the same table) of the current record instead of all fields? > I've tried this code: > > RunCommand acCmdSelectRecord &...

Outlook 97 and receive dates
Every message I receive is dated the first of the month. What is happening here. Can any body help me? Thanks Ralph Which month? - the current? What does your system date show? Peter >-----Original Message----- >Every message I receive is dated the first of the month. >What is happening here. Can any body help me? >Thanks >Ralph >. > ...

Turn pc speaker on/off with vba code
Is this possible? Thanks I found something here on how to do it withVBScript. You can probably modify it to work in VBA http://www.pcreview.co.uk/forums/thread-1468591.php -- HTH, Barb Reinhardt "David" wrote: > Is this possible? > Thanks Thanks Barb I'll have a go (I need to improve my web searching skills) "Barb Reinhardt" wrote: > I found something here on how to do it withVBScript. You can probably modify > it to work in VBA > > http://www.pcreview.co.uk/forums/thread-1468591.php > -- > HTH, > ...

Loading a Form from VBA
Hi all, I'd like a module to open and load a form in my Access 2003 database... How can I do this? Use the OpenForm method. Look in the Help file for details. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "Mike" <michael.leon.schwartz@gmail.com> wrote in message news:1184770076.109526.207900@o11g2000prd.googlegroups.com... > Hi all, I'd like a module to open and load a form in my Access 2003 > database... How can I do this? > On Jul 18, 10:58 am, "Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com&g...

VBA Customization
Is there a way to get the name of the current company through VBA in Great Plains 8.0? Thanks for all your help. open GreatPlains. Add the current window, it will add the Toolbar then add fields choose the company name on the top left after the user id. >-----Original Message----- >Is there a way to get the name of the current company through VBA in Great >Plains 8.0? > >Thanks for all your help. > > > >. > Thanks. I tried, but I couldn't add company name to the field list. It opens up the login screen instead. Any thoughts? Thanks again. "ger...

Form Controls vs VBA controls
I am new to VBA so just finding my feet, can anyone help me with th differences between an excel control (i.e. one from the form toolbox lets say a checkBox and a vba checkBox? From trying the two controls the I have noticed is that you canno capture the change event of the VBA checkbox in the code module, it ha to be done via the sheet (i.e. checkbox on sheet1, code goes in chang event on sheet1) the control is placed on, is this correct? What woul you do if you have three sheets with the same controls just differen data, do you really have to code the control 3 times? The excel control ho...

Run VBA without show
I want excel to run the VBA code without showing me what it is doing. Which code should i use for that? Sub RunWithoutShow() Application.ScreenUpdating = False 'Paste the vba code here 'end of code 'Change screenupdating property to true Application.ScreenUpdating = True End Sub I hope this helps... Selva V Pasupathy For more on Excel, VBA, & other Resources Please visit: http://socko.wordpress.com You may also (inserting into quote from code example bellow from Socko) Use Application.Visible property to hide the application entirely Sub RunWithoutShow() Appli...

Referencing a ComboBox in VBA
Hi, I am using Excel 2007. I want to run some code in my Workbook_Open() Sub that fills a combo box on one of my Worksheets (I will call it myCombo on mySheet). I tried the following code and it did not work: myCombo.Clear myCombo.AddItem "Item One" myCombo.AddItem "Item Two" myCombo.AddItem "Item Three" I assume that the problem is that within the Workbook_Open() Sub, the reference to myCombo is not valid. Can anyone tell me if/how I can get a valid reference to myCombo (on mySheet)? Thanks in advance, Paul Kraemer -- Paul Krae...

inserting and renaming a sheet vba
Instead of having 2 lines of code, one to insert a new sheet and one t rename it, is there a way to insert a sheet with particular name i one go -- Matt Housto ----------------------------------------------------------------------- Matt Houston's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=451 View this thread: http://www.excelforum.com/showthread.php?threadid=26717 ...

VBA??
Is there any way i can input certain numbers and they change to words. for example. 2001 Omagh 2002 Craigavon 2027 Housing Benefit 2036 IT Replacment any help please thanks monty If you mean you want to enter 2001 in cell A1 and have "Omagh" magically appear in its place when you hit the return key, I don't think it can be done. However, if you enter 2001 in cell A1 and have a VLOOKUP formula in cell B1, with reference data stored elsewhere in the sprdsht, that is easily done. Monty How many substitutes do you have? You are probably best to set up a separate table with ...

Using VBA to automatically add a new date to my table?
I would like to have my table (perhaps through a form) automatically add a new record with the date, every 24 hours, starting at midnight, 24/7/365 How do I do that? Also, And how do I search my username VWP1, because I tried searching users, typed in my VWP1 username, and no records were found? VWP1 On Fri, 5 Mar 2010 08:23:02 -0800, VWP1 <VWP1@discussions.microsoft.com> wrote: >I would like to have my table (perhaps through a form) automatically add a >new record with the date, every 24 hours, starting at midnight, 24/7/365 >How do I do that? Why th...

Need VBA code that enters the F2 Key upon entering the Field
I am using Access 2000. I understand that simply by pressing the F2 key while the cursor is in that field, you can toggle Off and ON the highlighting for that field (textbox). Can someone explain the necessary VBA code to perform this action without the user's intervention? "nytwodees" <nytwodees@discussions.microsoft.com> wrote in message news:E128AC11-3153-4A50-9873-F3BFACAC91B1@microsoft.com... >I am using Access 2000. > > I understand that simply by pressing the F2 key while the cursor is in > that > field, you can toggle Off and ON th...

Auto Calendars in VBA
Need to create a monthly schedule for work.To enter the dates (Numbers) into every other cell this is what I have so far Activecell.Select Activecell.Offset(0,2)=Activecell+1 I'm wondering is there an easier way to do this.Right now I have one module for the Year 2006 with sub's for each month.These will get called when form dropdown list show's that month. if frmMonth.cboMonth.Value="January" & frmMonth.cboYear.value="2006" then Call Year2006.Jan06 end if Is there an easier way to determine the today's date then creating Next month's c...

vba
salut j'ai une probleme sur vba que je n'arrive pas resoudre : j'ai un tableau de donnees (qui sont rentrees avec des userform). pour supprimer une ligne de ce tableau, j'ai cree un userform avec une liste deroulante dont la rowsource est la premiere colonne de mon tableau. je voudrais , en selectionnant une valeur ds cette liste, qu'elle soit selectionnee ds mon classeur excel pour que je puisse supprimer la ligne. merci de votre aide -- Ce message a ete poste via la plateforme Web club-Internet.fr This message has been posted by the Web platform club-Internet.fr ...

How do I set up a program just for income and expense?
I have started a small business and am in need of a very simple income and expense spreadsheet. Any suggestions? http://office.microsoft.com/en-au/templates/default.aspx -- Don Guillett SalesAid Software dguillett1@austin.rr.com "B" <B@discussions.microsoft.com> wrote in message news:7DE18135-2598-416D-B976-9825C06771F1@microsoft.com... >I have started a small business and am in need of a very simple income and > expense spreadsheet. Any suggestions? Go to this site and have a browse through the Business and Personal Accounting templates. Probably something wi...

Multi-Page table pasting as just one page
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I'm working with multi-page documents containing tables - once those documents are done the finished tables on them must be copy/pasted into another master document, containing many multi-page tables. The problem is that sometimes (maybe 25% of the time) a multi-page table that I copy from one document pastes into the master document as just one page. <br><br>The pasted 1pg table is hard to describe - the top of the table reaches far above and below the page (into the margins, right up against the ed...

VBA Training
Are there any good books out there that would assist someone who wants to learn VBA from the ground up? Something that would take a person from a beginner to mid-level or beyond? Just wondering what others have done to become proficient. Rick Hi Rick, I bought a book for Excel 2000 that is loaded with all kinds of useful stuff. The book is called Excel 2000 Power Programming with VBA, by John Walkenbach. It includes a CD. Over 800 pages, a big book. Donna "Rick" wrote: > Are there any good books out there that would assist someone who wants to > learn VBA from the ...

VBA #6
When opening Excel or attempting to export from MS Great Plains to Excel, I receive the following: "Could not run the Visual Basic Environment. Please run Setup." "An error occurred initializing the VBA libraries (1157)" I have run setup for errors and tried re-installing Office XP Prof. w/o success! Any suggestions? Thanx. You might try Detect and Repair on the Excel Help menu. -- Jim Rech Excel MVP "dcs" <anonymous@discussions.microsoft.com> wrote in message news:2a2701c47e33$4f1785b0$a301280a@phx.gbl... | When opening Excel or attempting to expor...

Outlook (97 Pro) stopped working in XP
I have XP/SP-2 with all the latest updates. I have Office97 Pro with SR-2 and am not going to part with it. Can't afford to get higher versions anyway. All the other Office97 Pro programs still work fine. My Outlook exe file version is. 8.5.5104.0 When I first start Outlook I get error message "The file add-in "DUMPSTER.ECF" is missing or not valid ..." then it goes on the tell me to find it and put it in the add-in folder. It is already in that folder ... corrupted maybe, but it's there. then when I click out of the above, I get another error message tellin...

Win Internet Explorer died
This Packard Bell PC with winxp home edition was bought 2ndhand ($600). Its about a 2006 model.Took delivery in January this year. From the beginning it was a bit twitchy if you asked it to do more than one job at once,..it would go real slow, but would catch up. Now when booting IExplorer the screen shows the window borders,..but no info comes up,..such as home-addy and what its connecting to. If you try and close it or enlarge to fullscreen it doesnt respond. Eventually a "program not responding" box comes, and you shut it down with "end now" "...