Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 36
Default how to format code in VBA?

Dear all,

I am programming in VBA in EXCEL...

Is there a way to automatically format the code when I inserted a lot of
things so it's getting very messy.

Which key short cut shall I use to automatically format the code?

Thanks alot!


  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 4,391
Default how to format code in VBA?

Not sure what you mean, but the MZ-Tools addin may be useful.
http://mztools.com/index.htm

NickHK

"cfman" wrote in message
...
Dear all,

I am programming in VBA in EXCEL...

Is there a way to automatically format the code when I inserted a lot of
things so it's getting very messy.

Which key short cut shall I use to automatically format the code?

Thanks alot!




  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 10,593
Default how to format code in VBA?

The best way is to format as you create the code.

First make sure that auto indent is set (in the VBIDE,
ToolsOptionsEditor), and then when you create code just use the tab key to
create another level of indenting.

When indenting something like a For ... Next loop, the bits inbetween For
and Next will be indented (at least) one more level, so you will need to
delet one tab in the Next line. The way that I do is is to code If ... Else
.... Endif and For ... Next without any intervening code, then the indenting
is maintained, and go back and add the rest of the code.

You can also automatically indent, un-indent blocks of code by selecting all
the lines and hitting Tab and Shift-Tab.

If you follow good coding practices, you will never need Stephen's indenter.
Whilst it is a verey useful tool, I personally have never had a use for it,
and I would be willing to bet that Stephen doesn't use it either.

HTH

Bob

"cfman" wrote in message
...
Dear all,

I am programming in VBA in EXCEL...

Is there a way to automatically format the code when I inserted a lot of
things so it's getting very messy.

Which key short cut shall I use to automatically format the code?

Thanks alot!



  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 13
Default how to format code in VBA?


"RB Smissaert" wrote in message
...
It is very good, but you have to be aware of one very important thing.
If you run the indenter on code that can't be compiled due to some syntax
fault then
it can hang during the indenting process and the only way out is with Ctrl
+ Alt +Del,
losing any un-saved work. So, best is always to compile first before
indenting.
I think this is a bug and it should be fixed.


I haven't come across that problem. Have you reported it to Stephen Bullen
(the author)?

By the way, before I do a smart indent like this, I *save* the template
first, so that in the event that it hangs, I haven't lost anything at all.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


  #5   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general,microsoft.public.office.developer.vba
external usenet poster
 
Posts: 2,452
Default how to format code in VBA?

Yes, I have reported it to Stephen, but as it was difficult to reproduce nil
happened.
I will see if I can make an example that demonstrates it. The problem is
that if it happened
the whole application is frozen, so you can't copy the code then.
I have had it several times and altogether lost maybe about 8 hours of work
due to it.
Still, it is good software and free and I still use it all the time. Just
need to be aware of this.

RBS


"Jonathan West" wrote in message
...

"RB Smissaert" wrote in message
...
It is very good, but you have to be aware of one very important thing.
If you run the indenter on code that can't be compiled due to some syntax
fault then
it can hang during the indenting process and the only way out is with
Ctrl + Alt +Del,
losing any un-saved work. So, best is always to compile first before
indenting.
I think this is a bug and it should be fixed.


I haven't come across that problem. Have you reported it to Stephen Bullen
(the author)?

By the way, before I do a smart indent like this, I *save* the template
first, so that in the event that it hangs, I haven't lost anything at all.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup



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
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Code Date Format Depending on Computer format Myriam Excel Discussion (Misc queries) 0 July 17th 07 03:26 PM
zip code format Rachel Excel Discussion (Misc queries) 1 January 11th 05 07:57 PM
code to convert date from TEXT format (03-02) to DATE format (200203) Gauthier[_2_] Excel Programming 0 September 22nd 04 03:26 PM
code for converting data format in another format mistral Excel Programming 0 August 19th 04 04:50 PM


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