Dear Flavio, Dear All
Surely code does not 'just stop'.
When there is an error the execution stops in the line with the error and this is highlighted in yellow.
A dialog box appears with a message describing the error. The clue to the error is in the message.
Flavio - Is this not happening. ?
Derek +++
>________________________________
> From: Gary Morris <gwmorris@att.net>
>To: "ExcelVBA@yahoogroups.com" <ExcelVBA@yahoogroups.com>
>Sent: Monday, 30 April 2012, 19:00
>Subject: Re: [ExcelVBA] VBA stops to run
>
>
>
>David's about right. All I can see is either permissions or
>there is some code that doesn't work. In my experience, if
>code doesn't finish running it's because there is something
>wrong or not quite right with it. If you rely on recording and
>then modifying macros, the code that Excel creates may not
>do EXACTLY what you intended, or it may do only the
>specific commands you gave while recording. Adding loops
>and conditions is always something to do carefully, and to
>really do it right always make sure you understand the
>generated code (IF you recorded it). It usually takes me a
>while to not only figure out what it's doing, but how to go
>about changing it. If you are NOT recording the macro, it
>might help to try it and get a better idea of how XL thinks
>about it. Given what you have shown, it could be a number
>of things, which is why I would just record a separate macro
>to see what commands it generates.
>
>For me, it would be worth a try anyway!
>
>
>G.
>
>________________________________
>From: David Grugeon <yahoo@grugeon.com.au>
>To: ExcelVBA@yahoogroups.com
>Sent: Monday, April 30, 2012 7:36 AM
>Subject: RE: [ExcelVBA] VBA stops to run
>
>
>
>Possibilities are:
>
>The workbook is opened as read-only
>You do not have write permissions in the directory holding the workbook
>There is a macro in the workbook which is triggered when you save it
>The workbook is not the active workbook at the time you issue the command
>The code saves the workbook but the next command is defective
>
>Try stepping through the code and checking what happens then.
>
>Best Regards
>David Grugeon
>Excel VBA Group Moderator
>
>-----Original Message-----
>From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com] On Behalf
>Of Flavio
>Sent: Saturday, 28 April 2012 1:00 AM
>To: ExcelVBA@yahoogroups.com
>Subject: [ExcelVBA] VBA stops to run
>
>Good morning gentlemen, i need some support..
>
>I did a code to import the content from some spreadsheets. Those
>spreadsheets that i'm importing has macros. I opened, and imported the data.
>The problem is that after that i need to do one change, save, and close the
>spreadsheet.
>
>When i try to save the spreadsheet, the codejust stops to work. Just stop.
>I already tried some things, but none of them really worked.
>
>Detail: I'm working with excel 2010, but saved my spreadsheet in the format
>.xls. The spreadsheets that i'm opening also have this format.
>
>In the first version that i did, it shown the compatibility checker screen,
>warning me about "significant loss of funcionality". I clicked in continue.
>So after that the code stops, as soon as i execute the instruction
>ActiveWorkbook.Save
>
>After that i created a second version from my program, with 3 lines before i
>save:
>Application.DisplayAlerts = False
>Application.EnableEvents = False
>ActiveWorkbook.CheckCompatibility = False
>
>The compatibility checker message was gone, but the code still stops to run,
>in the same line ActiveWorkbook.Save.
>
>I appreciate any help about. I tried to think in different solutions, but
>right now i dont have a clue why this is happening.
>
>Regards to all
>Flavio
>
>------------------------------------
>
>----------------------------------
>Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go
>here: http://www.mousetrax.com/techtrax to enter the ezine, then search the
>ARCHIVES for EXCEL VBA.
>
>----------------------------------
>Visit our ExcelVBA group home page for more info and support files:
>http://groups.yahoo.com/group/ExcelVBA
>
>----------------------------------
>More free tutorials and resources available at:
>http://www.mousetrax.com
>
>----------------------------------Yahoo! Groups Links
>
>[Non-text portions of this message have been removed]
>
>
>
>
>
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------