I subscribe to the Word-PC list where MS Word users post about their issues they are having with the software. This post is from Lisa. While she was asking specifically about VBA coding, I am answering based upon what I do with my HTML / CSS coding.
Lisa wrote:
This is a question for everyone....
I've had occasion lately to have to convert someone else’s code. I'm not going into whys or wherefores... But it's raised a number of thoughts for me and I thought I'd try and get *your* thoughts on VBA coding as well. Soooo!!!!!I'm trying to look at the way people code and why.
How do you process and debug code? I run my code in IE 7 and verify that what I just coded worked the way I want it to work.
Do you write code that doesn't need it?
Not sure I understand.
Do you use Debug.Print a lot?
N/A
Do you make use of breakpoints or Stop statements?
N/A
Do you use MsgBox?
N/A
Do you use the status bar?
N/A
Have you developed anything that you use to debug code?
No
Do you use 3rd party software?
I use the tool to validate HTML to verify my code is okay. That is mainly during troubleshooting why I am getting an error.
Are you *always* successful in finding faults and if so ... How do you do it??? :-)
Yes. I continue to pound and pound away at my code until it works. Failure is not an option.
Do you include any code "as a rule" for "debugging"?No.
Do you use line numbers?
No
Do you include an exception routine in all of your procedures?
No
What are the advantages of working the way you do?
Since I’m 100% self-taught, I don’t know any other way to do what I do. I just write HTML code, test it in the browser and, assuming it works, I move on....
And of course... Do you think there are any disadvantages and what are they?
I think I’ve been able to pick up formatting of code to make things easier to read. However, doing so takes more time than I want to spend so that leads to code that is sometimes difficult to read.
Do you *Always" do anything?I always try to add a comment in my code if I think it will help me in the future....
Why do you think it's good to do so?I won’t remember things in the future and having a trigger – whether it’s a project # that caused me to change something or a sarcastic “I know you won’t forget how long it took you to make this code work” comment – I think it leads me to the resource that caused my changes.
Have you ever seen code for which you though ... OMG!??I don’t know if that’s a OMG – cool or OMG – what the hell is happening. I’ve done both. I right-click and View Source a lot when I see some effect. I routinely adjust code to make it bend to my will.
Have you ever seen code for which you thought... Neat!Tons of times, especially with JavaScript.
Ever had to change code that other people wrote and er... Had some problems?... What were they?
I had code for adding customized links to my HTML pages and it caused IE 7 to choke. Had to take it out.
Are there any "standards" that you would always advise?If you have any question re: whether you will remember anything, add a comment.
Is there anything that you think... Nah... It's not necessary?
Formatting code. I’m not as picky anymore. It makes it easier to read, sure, but it’s not worth the time to format every piece of code I write.
Had any particularly interesting hurdles lately that you've overcome or worked around?
Running WebHelp in the c:\dir1\help directory, using Mark of the Web (MOTW), you cannot open a PDF file. I have to create 229 .htm files, 1 for each of my PDFs, so that I can display the PDF on the PC.... Why did you have to work around it?è Users couldn’t open a PDF in our online Help system./...
How did you get past it?
Cursing and Google.
Got any useful web sites to share that you've gotten solutions or ideas for solutions fromGoogle.
Do you use a naming convention for your variables...... What is it... ... ... Your own?... ... ... Why? What makes your naming setup easy for you?... ... From another source?... ... .... Why that one? N/A Do you always use Option Explicit?... Why?... Why not?N/A
Do you comment a lot?I try to add comments to help me remember stuff.
When you deliver code do you obfuscate?Never heard of it, so I used Wikipedia: http://en.wikipedia.org/wiki/Obfuscated_code No, I don’t obfuscate code.
When you deliver code do you insert line numbers for debugging?No.
Do you document you code separately?Yes. I maintain a Word doc that explains how to write documentation for my employer. It is over 400 pages and has lots of useful information.
Do you use the comments in your code as documentation?No! I’m writing the documentation for my company’s software!
Do you think... As a lot of people do!!! That if you have to document then it's too difficult to use?
I think that what makes perfect sense to me does not make perfect sense to someone else. Therefore, by commenting or updating the aforementioned Word doc, I hope I can give an insight into what I was thinking or trying to solve at the time.
The next subject is using Word to code HTML
Karen, on the Word-PC list, posted this:
My team recently started using a content management system. The content is formatted in HTML through a WYSIWIG that's not too useful and sometimes does odd things to the code. Mostly we'll be composing new content directly in the WYSIWIG -- that's no big deal. Occasionally, though, I'd like to use Word to organize and edit the text because Word just has a lot more useful tools to help me with the editing process. I'd like to create a Word template that'll produce relatively clean HTML.We've gotten relatively good results by copying the content from Word to Dreamweaver and then copying the code from Dreamweaver to the CMS. We'll always have to do additional clean up once we get the content into the WYSIWIG, but I'd like to make it as easy as possible. Any ideas for formatting in Word that'll make the transition cleaner? Types of formatting tricks to stay away from or to always use. We use a lot of numbered and bulleted lists and that's our biggest headache.
Thanks,
Karen
To which I wrote back:
If you already have Dreamweaver, why on earth would you write HTML in Word? Quit trying to use Word as a HTML editor. It doesn't suit your requirement -relatively clean HTML - and is only going to make you take longer to do things that would take less time if you just coded in DW in the first place?
Word doesn't belong in your equation so remove it. If you really want to use Word, preview your code in IE, ctrl + A, ctrl + C, go to Word and ctrl + V. That'll get your content into Word. Use that Word doc to do whatever editing process you need to do and then make the same text changes in DW. Double your work, but you're already not working efficiently if you're trying to get "relatively clean HTML" from Word.
which triggered some sort of holy war:
Notepad in Windows make clean HTML but it is much work and tables are no fun.
In Word it goes quickly but no clean code.
Dreamweaver adds another license and training cost.
Word is free while all has it and can make documents. Easy training to learn to save as Web Page.
Excel is also free and can be used.
to which I wrote back:
Word is free? Really...
After considering what the person probably meant, I wrote this:
Additionally, just because you already have a copy of Word - if that's what you were getting at - it is not free if you have to pay someone to clean up the HTML code. Plain and simple, if you want clean HTML code, Word is not the right tool. If you want to have ugly code, sure, go ahead, use it. My point is that if the original poster wants to have "clean HTML code," Word is not the tool, especially when they already have Dreamweaver.
David G chimed in with this:
Tables in Dreamweaver are a breeze IMHO, and the trash that Word (or and other M$ Office product) generates is a real pain to clean up. General users shouldn't be making HTML anyway in this case I would think. Learn DW and move on.
Meanwhile, about this time, on the Dreamweaver list I'm on, this post appeared:
Cheryl D Wise wrote:
Publisher is a desktop publishing program also know as a print tool. Despitewhat Microsoft says you should never use it for web work. Same goes for Word, Excel and other Office programs. Yes, you can save content from those programs as html but that doesn't mean they should be used.
-----Original Message-----
From: "Melissa
Hello! I am new to this group and just wanted to introduce myself. I started my own virtual assistant company earlier this year, and tried to design a website using a template, but was never happy with it. Then I downloaded Kompozer and messed around with that a lot, never able to get it the way I wanted. THEN I designed (what I considered to be a first timer's masterpiece) through Publisher, only to find out that it was a complete waste of time because Publisher's coding is not universal and wouldn't upload properly. SO, I finally buckled down and paid for Dreamweaver. Now I don't know how to use it!!
Then back on the Word-PC list, this appeared:
From: Don
Since they already have Dreamweaver cost isn't an issue. They are taking the document from Word and importing it into DW now so they obviously have at least a rudimentary knowledge of how to use DW. They would be much better off taking the time to learn DW better as the results would be considerably better overall.
Positive reinforcement for what I had wrote! Yeah! Then... the horror stories roll in:
FYI Recently, I had to make a quick change to a web site. I ftp'd the file, saved it to my desktop, made the change in MS Word 2003, and FTP'd it back. Whole site went belly-up. Word kindly changed all links on the page to blah blah desktop blah. Had to replace the links in notepad. Not a happy camper.
David G chimed in again with
I use DW as a rank amateur. I would much rather use it than Word. The learning curve was not that steep and I am self-taught. In a standardized corporate environment I would suspect that some common rudimentary training in DW would be all that is needed. OTOH, Someone with reasonable VBA skills could probably write a WordAdd-In that could parse out all (or most) of the offending parts that Word insists on putting in.
That led to a comment that Dreamweaver has a "Cleanup Word HTML Code" option. I found it on the Commands menu.
So that was my day, while trying to fix my issue with MOTW and my PDFs.
Finally, I came home and, in order to help Alex prepare for his science test tomorrow, guess what I did? Yep, typed a study guide in Word so that he could practice matching the vocab words with the definition.
No comments:
Post a Comment