Getting near to the finishing line …

To say that I’ve had to do a few improvements, code changes, bug fixes etc. to v1.74 would be a bit of an understatement. I’ve currently got revision j being looked at by my colleagues and tweaking code to fix bugs/form layout oddities that they spot into a new revision k. The good news is that that I’m hoping I’ll finally be able to release it as a v1.75 very soon.

gettingneartofinishline_22092014

A new function has appeared on the reworked first tab which will allow you to toggle the Enforce Styles status on the current open document – assuming it’s not protected in some way.  This was a new function that I didn’t know existed within Word. But, as with a lot of this add-in, I’ve picked up more knowledge in how Word works by tinkering in VBA, than I have in all my years as a technical author.

All being well, when I release v1.75, I’ll also be releasing the full source code so you can all have a nosey (and maybe a laugh or three) 🙂

GUI alignments and new code added today

My colleague has been very busy yesterday and today logging GUI-related ‘oddities’ on our Trello board.

I’ve fixed quite a few of them but some are not possible to fix without a complete design overhaul, e.g. all of the text boxes are set to ‘Locked’ status so that they are used for display purposes only. However, three of them allow text entry and as soon as a change is detected – typing in a Section Break or a Table number – the GUI moves the user to that position in their document. So as a test I’ve sent out yet another preview (‘h’ so far!) of v1.74 with a small amendment to these fields so that they now have a yellow background. This denotes “yes, you can type in stuff here” and we’ll see how that goes down.

In other news, I’ve overhauled the first screen completely. Lots of new information is displayed. It’s not the final version (as I’m not sure if I like the blue colouring of the frame text ..) and there’s a gap on the right-hand side of the top frame which looks like it could do with some extra bits adding to it.  Or not.

guialignments_18092014

A busy day fixing mini bugs here and there

I set up a Trello board the other day to save me having to update a TWiki page each time a new feature was added or a bug was squashed.

A work colleague (who uses the add-in probably the most) has been very busy testing the latest beta (v1.74f) and raising all kinds of “mini bugs”.  Cue email after email from the Trello board with all of the separate posts, plus a copy of my replies, where I’ve moved the card to once the bug was squashed etc. My apologies to all the other members of the same Trello board as they would have got the same Trello ‘spam’ 🙂

One of the “mini bugs” was purely because of typo in the source code that examined the result of a combo box .. very embarrassing for a technical author!

She’s now testing v1.74g out and hopefully the bug fixes will pass her stringent tests 🙂

Fix Columns now working …

That took some re-working of my code too. And all due to Word’s (or VBA’s) handling of tables that can have split or merged cells, or those with different widths and heights to each other.

The code isn’t perfect as there are ways of interpreting non-uniform tables but having spent most of the morning trying to work out the best way to allow the formatting of columns, I’ll put that on my ever-growing To Do list.

Here’s the updated form from the GUI with the new functions. I had time to add an additional entry into the table (it now shows the table style in use) and also add a new function to allow you to go through and change the style of any of your tables in your document.

fixcolumnsnowworking_16092014

This version is currently being tested by my colleagues so once it’s ready, I’ll sort out a new v1.75 release at some point this week (all being well).

Then it’s onto the next function …

Using VBA to fix columns in a Word table …

I sent out the preview of the Table Inspector to a few colleagues in work. All seemed to go well. The initial bug found was fixed tout suite but before I sent the update out, someone asked if I could do the same thing with columns as I had with rows.

Seemed easy enough to me, so I added the extra label, text box and spinner. The rows code was mutilated and adapted so it could handle columns (or so I thought) and I added the extra functions and variables to the initialisation routine. This went very well and then I ran the code – I kept getting the same error over and over.

After some reading up from various Word MVPs in numerous forums, I came across a simple bit of text that explained my situation: “Word VBA really hasn’t got a clue about columns. And if you’ve got merged cells, then it really panics!”

So I now need to rethink the loop that goes through each column and change it so it looks at each column, counts the number of cells, sets that as a known range and then go through *each* cell, one-by-one, changing the font and the alignment as the user requested.  What a pain that’s going to be.

Ho hum – that’ll teach me to think I can copy & paste existing code and assume Word VBA knows what I’m trying to do 🙁

First working version of Table Inspector handed out

It’s ugly and needs a lot of GUI tinkering. But it works.

firstworkingversionoftableinspector_15092014

The main window shows all the tables that exist in the main document (not the header or the footer). The status of the AutoFit is displayed, along with the Heading Repeat status of the first row. Then the rows and columns appear at the end of the list.

You can change the AutoFit status – but only for tables that Word classes as ‘Uniform’.
You can toggle the Heading Row Repeat option on/off for each table in the document.
And the main request from my work colleague was for a function to format the top x rows (*) of each table you select with a particular setting of font attribute and alignment.

(*) x is calculated as the highest row count of all the tables .. I need to add some checks in so that any attempt to format the top 15 rows in a table that only has 11 will give an appropriate error.

I’ve also been asked to replicate the same functionality but for columns. So the above GUI is just a temporary one 🙂

Work continues on the Tables function

I’ve been pondering over the types of functions that I would like to see (and use) in the new Tables function I’ve been coding.

I’ve got it nailed down (for now) with the ability to toggle the Heading Repeat, toggle the AutoFit and change the bold, italic, underline and alignment (left/centre/right) of the text in the first row.

I need to look into some tables though that might have dual rows as their headings .. whilst I’ve not seen them in any internal company-wide documents, I’m sure that others will use them. Once I find some good examples, I can see me having to widen the screen a bit more .. which in turn widens all the other tabs.

New feature coming soon in v1.74

The FixTables was recently overhauled and some extra error-checking was added to the routine, mainly to cover the situations where a non-uniform table was in place.

A non-uniform table for those unaware (like myself, when I couldn’t fathom out why my error checker kept kicking in) is one where it’s not a perfectly formed table. This could mean it’s got a merged cell (horizontal or vertical) or one where just one cell is slightly larger/smaller than all the other cells in the relevant row or column.

So this got me thinking .. how’s about if I use the FixTables code and merge it into a routine similar to the Section Break Inspection tool where you can see all the tables in your document, along with their AutoFit status, if the Heading Row is being repeated and the usual stuff you’d expect such as the number of rows and columns used.

This will also include a few extra functions, along with the original code that formed the FixTables routine. You can apply these fixes to one, some or all of the tables in your document.

Here’s a WIP screenshot of it so far:

newfeaturev171_08092014

Note: As the code has been moved to the Toolbox GUI, the FixTables routine will be removed from the QuickFixes list on the Ribbon too – as it’s pointless appearing twice.

Possible Mac version (but don’t hold your breath!)

I don’t own a Mac machine. The last time I used one was when I worked on a helpdesk (between 1996-1997) when I was supporting John Lewis customers who had bought iMacs … sometimes just to match the kitchen wallpaper and other such excuses!

The other half has an old Macbook, but the likelihood of her handing it over to me whilst I get a Mac version up and running is fairly slim. That and she thinks I’d erase the pirates-themed game that is her lifeline when she’s bored.

So after a bit of Googling, I’ve found a tutorial on Lifehacker on how to get a Virtual Mac OS/X machine running on my new souped-up PC. If it works, and I can borrow the other half’s Office 2011, I’ll give it a go.

Advanced VBA Training Course

I’ve just attended a 2-day training course on Advanced VBA (run by Wise Owl) in the centre of Manchester (UK).

Very good it was too!  There were quite a lot of notes jotted down (on paper and in the middle of the code I was writing) and lots of ideas kept popping into my head. Now I just have to convert the ideas into workable code.

That will have to wait for a few days though as I’m attending a monthly Technical Authors meeting (official title: The ISTC North West group) and I will be demoing v1.73 (maybe v1.74) to the other technical authors present.

Maybe they will have even more ideas for me to implement.