It’s getting there (Document Overview Report)

Progress

I’ve added in Images, Shapes and Custom Styles into the report generator. So it’s coming along.

However, it’s not without any difficulties due to the way Word VBA handles the insertion of a new table. I’m still getting used to the way that it works, for example:

Normally, you find the table in your document and then edit the cells, change the formatting or whatever else you want to do afterwards.

However, when you’ve inserted a new table into a separate document (besides the to-ing and fro-ing between the two documents), you have to insert the table, then loop around and add the cell contents (from the array) and *then* you apply your choice in formatting afterwards. If you do it in any other order, it basically ignores all of your commands. This has been very confusing during the development of the reporting function.

What’s left to do

Looking at my Trello card that lists the work done and the work that I still need to do, there are a few more mini-functions to report on. I also need to tidy up the Which Fonts routine – what appears on-screen and inside the report.

I also need to include an option to skip past certain options (e.g. Fields) in the report if their count is too high, e.g. more than 100 fields. One of my test documents is very TOC-heavy as the field count goes up to 900+ entries. This breaks down to the usual field entries in the footer for page count, current page number and such like. Where it increases to silly amounts is down to the TOC. For each entry it’s one field for the actual section of the document that it’s referring to and another for the hyperlink that jumps to the correct section as well. The totals soon rack up.

I know I’ve said this before in other posts regarding this function, but it’s getting there. Honest!

New beta available (v2.1f)

I’ve finally released a beta version of the Toolbox now that the Report Overview function exports into proper tables. The full suite of reporting options aren’t in there as I’ve got to add Custom Styles, various language detection, template names and both types of image: inline and shapes. But it gives you an idea of what the function will be able to do – that is, what you would see in the Toolbox’s GUI, is now dumped out to a Word (or a PDF) document.

My next stage for the website update is to start adding videos showing how the functions work “in real life”, with proper test documents. I attended the Manchester WordPress User Group last night at MadLab for the first time last night and picked up some good hints and tips on image optimisation from one of the speakers (Kayleigh Thorpe from 34sp.com).

I also talked to her during the clinic time afterwards about using videos and she gave me some good hints and tips. Whether I use my current YouTube account, or create one specifically just for this website is a decision I’ll make at some point.

Another update on the Document Review function

It’s coming along nicely. Albeit with a lot of grey hairs being added to the head (and beard) as I split the functions apart from the listboxes into arrays.

This morning I finished moving the Fields code out of the form and into the new ‘MainLoops’ module and it, like the others before it, now uses arrays. This means the listbox can be populated as well as the report using the same data.

All that’s left to do (ha!) are: tables, images (both inline and floating) and custom styles.

What’s they’re done, then I need to investigate how to “make it look pretty” by using tables to display the data. The report does look a little bit on the ugly side when there are hundreds of fields (e.g. caused by a large Table of Contents) being dumped into the report.

When I’ve got all of the export features embedded (in their current ‘ugly’ mode) then I’ll release a beta version so that I can get some input on what other’s see when they link the report to their Normal.dotx files.

Working on a new feature: Document Report/Overview

For those technical authors (like myself) and other power Word users, there comes a time when you get a document which contains all manner of errors and problems that you need to take a step back and work out what needs fixing before diving in there.

My toolbox can help you fix those problems, but it would be better if you initially had some kind of overview ‘report’ on what is actually inside it. Whilst you can print out a list of the styles used with verbose details galore about each one, Word doesn’t offer much more.

So, to help plug this gap, the next feature to be added to my toolbox is the Report one. It’s not fully working as such, in  that it will only extract the basics such as the standard built-in properties and various statistics and counters (number of sections, tables, images etc.) and place them into a new Word document. By default this will be inside the same folder as your source document, but you can configure the destination folder.

You can also specify which Word template you would like to use with the report or, by default, it will use your current Normal.dot/Normal.dotx’s styles for the Headings et al.

As you can see from the screenshot below, it’s been placed between the main Inspection Tools and the Configuration options. What might change is the name of the function, which for now is just ‘Report’.

The full function will extract everything that my Toolbox can display, but in a Word document. In theory, you will get a document that you know has a few problems, so you generate the report first and print it out before starting to fix the problems within the document.

As soon as I’ve got a bit further with the development, I’ll post an update on here.

The latest verison (v2.0) of my Word add-in is now available

The what?

I have been developing a Word add-in called Mike’s Toolbox for the last 2.5 years within my spare time: some of it at work, some of it at home. It started out life as a small collection of macros (without any proper GUI) that would fix a number of particular annoyances that kept cropping up in documents where I work.

It is a tool for technical authors, proofreaders or those who would class themselves as ‘power’ Word users. Within the toolbox are lots of features designed to help you fix / improve any Word document. If you know of anyone else who could use this toolbox, please pass on the information about this new release.

I do not charge for this add-in, nor the full source code which I also give away with each new major version.

However, it’s not a tool that will help you create content, nor generate fancy templates. There are other add-ins out there that do that for your Word documents.

New website

Part of this release is to announce that my new website is available. I have moved everything across from the old Weebly-hosted site to the new one – my own proper domain, at last!

The full release of the add-in, including the manual can be found on the new site. Also included is the full VBA source code as a separate download for those that find this side of things interesting.

I couldn’t find a tool that would extract all the blog entries from Weebly and then import them into WordPress – so it had to be done by hand. One blog post at a time 🙁

The new site can be found here: www.mikestoolbox.co.uk.

New version

I’ve upped the version number to v2.0 for this release. This is partly to introduce the new website and partly to enable a better numbering scheme for my forthcoming beta versions.

What’s new?

  • The About box now points to the new website. All traces of the Weebly-hosted site have been removed from the code and the manual.
  • Added ‘Delete TOCs’ and ‘Delete Indexes’ options to the Fields Inspector function. As part of this GUI alteration, I’ve moved the Delete fields option into a new frame called ‘Delete Options’. The old frame has been renamed to ‘Field Tweaks’.
  • A request came from work colleagues for the Fix Footer option to include a facility to insert the SharePoint version number. I.e. A document is checked out and therefore it has its own internal SharePoint revision number. This number is placed into the footer instead of the contents of the Comments or Subject fields as per previous versions of my toolbox.
  • When the document is checked back in, the version number will automatically be increased by a major and/or major/minor version number by SharePoint. This saves the current document editor the task of doing it themselves.
  • In order to make room for the new Content Type functions on the Footer tab, I’ve had to do some GUI rearranging. I had to increase the size of the whole Toolbox form by about 20 pixels. This meant all of the other tabs needed some tweaks to spread them out a bit to fill the gap created, but it will mean larger list boxes on display. The changes to the Footer tab are as follows:

a) Renamed the tab from ‘Footer / Information’ to be ‘Footer / Back To Basics’ – as there’s no information included on there, just footer and back to basic tools.

b) Removed the Refresh button as all of the functions automatically refresh the display after they have completed their task.

c) Moved the ‘Odd/Even Header/Footer’ Swap option to the bottom of the form.

d) Moved the Back To Basics to be in a single line and also now at the bottom of the form.

e) Moved all of the tweaks that are possible with the Fix Footer into the one frame.

f) Moved the Fix Footer’s status outside of the tweaks area, along with the Fix Footer button and that is now larger and in red too.

g) I also added the Please Wait form to the Fix Footer function when there are more than 5 sections in the document. I will investigate where else I can place this so that you are aware of when fixes are taking place and don’t think that the Toolbox, or Word, has crashed.

  • As part of my long-awaited list of To Dos, I’ve started adding in the section type to some of the functions. First off is the Field Inspector which now displays the section type in brackets after each of the field’s content.
  • Did some shrinking of buttons within the Table Inspector toggles frame and made enough room to add a new function to toggle table borders on/off.
  • However, this doesn’t allow you to customise which of the borders are on/off, it’s just a simple on/off per selected table.
  • Removed the refresh buttons from both Endnotes and Footnotes forms. Added ‘Update’ buttons to both the Numbering Rule and Numbering Style combo boxes on both forms too. All as a result of finding that the code that updates the listbox was being called multiple times in the previous releases. The Convert and Delete buttons have been laid along the same horizontal line too.
  • Added a simple display option for any Building Blocks found inside a Word template file. It’s a ‘no thrills’ option which I hope to improve over time.
  • Removed the Read-Only/Read-Write status check that appeared underneath the main Toolbox form. The read-write status of the current document is now done, as per all the other Inspector tools, prior to launching the function. This enabled me to remove about 15 different checks of the status that were inside the main Toolbox’s code.

That’s all that’s new. More details will be in the manual.

What’s been fixed?

  • A bug was found in the Field Inspector when I added an index to the manual – mainly because I’d never created/used indexes in a Word document before. The Field Inspector had made some assumptions about index entries and that’s now been fixed.
  • Fixed an odd bug in the Endnotes/Footnotes code that created the listbox. For some reason I was calling the routine to populate the list box three times in a row due to the use of ‘_Change’ event each time. So, for example, if there were 4 endnotes found, they were being listed as 12. The four endnotes and 8 blank entries. Bug quashed!
  • The Section, Field and Table Inspectors weren’t checking if multiple documents were open. They do now.
  • I’d not included a description in this manual to cover the Odd/Even Header/Footer option in the Footer / Back To Basics tab. Oops!

That’s the list of bug fixes that were hanging over from the previous version.

Optimisations!

I have learned a lot about optimising my VBA code during the update from the previous version (v1.89) to this new version. So much so that some of it will feature in my next article for the ISTC magazine, Communicator.

To save boring you with examples of code, all of the optimisations can be found in the Change History section of the manual.

All in all, the optimisations have helped to shrink the add-in down by quite a margin. The v2.0 of this add-in is now smaller than the previous release (v1.89) but includes new features, along with the bug fixes. The VBA source code is shorter too, by almost 400 lines of code/comments and line spacing.

Site updated ready for v2.0’s release!

I’ve updated most of the pages with the latest screenshots. I had to install yet another WordPress plugin as, annoyingly, if you want to replace an existing screenshot you have to upload a fresh one, delete the old one then rename the new one and then it should (!) appear on the page.

Or you can install the Enable Media Replace plugin which will allow you to upload (one-at-a-time) the replacement images and it does all of the work for you. Which is much easier.

The download and source code pages will be made available tomorrow and there will be the usual links appearing on here, Facebook and Twitter. I’ve almost finished the announcement article on LinkedIn and that will be made live tomorrow too.

This version might not be a massive update, but it’s:

a) smaller due to the optimisation

b) has some bug fixes

c) has a few extra features.

Have fun!

More code optimisations and a new beta available (v2.0 preview)

As my first official post on this new official website for my add-in, it might be a lengthy one 🙂

Code optimisation(s):

There are several that I’ve discovered, including a variant of the ‘IF’ command that I didn’t know existed.

First

There’s the condensation of a line of code. I’ve done this before in previous “how can I shrink the code” runs, but due to some “copy & paste coding”, I’d got lazy and had forgotten that I should be doing this.

My Old Code:
CheckProtection
If blnProtected = True Then
 Exit Sub
End If
The New Code:
CheckProtection
If blnProtected = True Then Exit Sub

That’s three lines of code into one.

Second

This is the new IIF function that I never knew existed in VBA. It is very similar to the IF function that can be used in Excel formulae in that you store a result from a test, based on whether the answer is true or false. I do a *lot* of these kinds of tests in my code, mostly within the generation of the list box contents for the various Inspector-type tools.

My Old Code:
If .Rows.WrapAroundText = True Then
 strWrapAround = "Y"
Else
 strWrapAround = "N"
End If
The New Code:
strWrapAround = IIf(.Rows.WrapAroundText = True, "Y", "N")

That’s five lines of code into a single one. That’s going to help shave quite a few kilobytes off the size of the final release of v2.0 when I’ve gone through the code and fixed them all.

New beta:

There is a new beta available (v2.0 preview) which can be downloaded via the DropBox links on the Beta page. I completely forgot to update the GoogleDrive links, but I will fix that tonight. This will be the version which will have some, but not all of the code optimisations as mentioned above. All being well, there will be a noticeable difference in the size of the release version, compared to this beta.

Download, install and let me know via the Trello board if there are any changes needed.

Work started on the new beta

And it’s already up to v1.90e due to the work that I’ve been doing. So what’s been added/altered recently?

a) I added an Index to my manual. This was going great until I tried to use my own Field Inspector tool to list the fields and the presence of the index caused it to crash. Oops! So that was a quick and necessary fix. Whilst fixing this bug, I did some GUI rearrangements and split the Delete Fields button into a separate frame and added two new features: Delete all TOCs and Delete all Indexes.

b) A request came from a colleague to add in an option to include the version number that SharePoint gives a document when it’s checked back in, instead of the version number that was previously stored in either the Subject or Comments field. The research into this code took some time as Microsoft really don’t want you know how this can be done in code. Or that’s how it seemed to me as I went from forum .. to forum .. to another forum.

In the end I found a solution using the ActiveDocument.ContentPropertyTypes function. This means that my colleagues can now insert the associated SharePoint field into the footer and it will be updated when the document is checked back in.

c) However, doing the above meant a few extra fields were included on the Footer / Information tab. Which meant that I had to include the height of the Toolbox form so that it didn’t look ‘squashed’. This was done and then I had to spread out the other fields/functions on the other four tabs. All in all, there’s more room for the list boxes on the Styles, Comments and Bookmarks options.

Currently the beta is up to v1.90e, but as I’ve not finished with the GUI redesign for the Footer / Information tab, I won’t be releasing it via the usual DropBox/Googledrive links just yet. So please bear with me.

Updated version of my Word add-in (v1.89)

It’s been a few months since the release of v1.87, but after several incarnations of the beta (v1.88), I can now announce the availability of v1.89.

There have been *lots* of changes: either to existing features, or adding new features. I’ve also fixed some really embarrassing bug fixes and, as a visitor to this blog, you know that I don’t hide from my mistakes, so they are all listed towards the end of the manual. There are a smattering of D’oh! comments in there after I’d worked out how to fix somethings that I’d broken in the first place!

Download & installation

Existing users

As the following lists are quite lengthy, I’ll give those who are impatient to get the latest version the URL to go to: http://mikestoolbox.weebly.com.

Download the .ZIP file, unpack the files and overwrite your existing copy with the new version and away you go! I would double-check your configuration just to make sure nothing has changed, but it shouldn’t matter.

New users

If you are a new user, then follow the installation guide in the manual and remember to use the Configuration form first to set up the few items needed. Leave the Expert mode toggle off until you’re tired of all the message boxes appearing 🙂

New features

  • Table Inspector: Reset Table To Normal has been added. A quick fix to reset all the selected tables to be reset back to a standard looking table. Handy for fixing those tables which have an odd look and feel.
  • Table Inspector: You can now remove any empty rows or columns. The function to do columns is a bit slower as it has to do more background checks to ensure it doesn’t ruin a table’s layout.
  • Section Inspector has had a major overhaul. If I’m honest, I didn’t like how the first release of it worked in v1.87, so it’s been rewritten from scratch and lots of extra functionality added. I hope you’ll like the new version 🙂
  • Endnote/Footnote Inspector: A new function to handle endnotes and footnotes within a document.
  • The Image/Shape Browser has, thanks to some suggestions from a beta tester, had a bit on an overhaul. Lots more functions in there, including a preview of my ‘select one or multiple select many’ toggle. If this is liked by the users, I’ll adapt it for other listbox-based functions.

Enhancements to existing features

GUI tweaks:

  • When running the toolbox on my PC at home, connected to a 42″ TV, I noticed that several buttons and labels weren’t displaying correctly. All are now fixed.
  • Removed all of the ‘Close’ buttons from all forms. There’s the standard X in the corner of each form to use instead, plus it gained me some form space for extra functions on quite a few forms.
  • Buttons that replace or remove items from your document (singularly or in bulk) are now displayed in red, as a ‘warning’.
  • The Please Wait form now includes a total of the items being examined to show you how many the current function needs to work through.
  • Increased the width of the Fields Inspector form to allow more detail to be viewed.
  • In most listboxes, you cannot use the functions *until* you have selected at least one item.
  • You can now alter the size of the font used for the text that appears in the Fix Footer routine.
  • Fields Inspector form tidying has been done. Some of the field types weren’t being displayed and now are.

Other fixes:

  • Added a check to the Replace Style function to check that you aren’t trying to replace the same source and destination styles.
  • Redid the layout of the Table Inspector form to allow extra features to be added.
  • Rejigged the Inspector icons on the Toolbar so that the magnifying glass image on each icon are now facing the same way. No idea why I hadn’t fixed that sooner.
  • The main Toolbox feature appears a lot quicker now as it was being slowed down due to the inspection of the styles in a document. This is now performed only when you click on the Styles tab.
  • An crash occurred when Readability Statistics was used on a document with multiple languages. I’ve added an error trap and a message box will suggest that you fix the document to contain a single language before attempting to generate the statistics.
  • Removed the ‘Replace F & S’ bulk fix as it wasn’t as useful as I thought it might be – for me or for the person who suggested it. Them’s the breaks!
  • Quite a few bugs had cropped up in the Configuration form when I was attempting the Mac port a few versions ago. For some reason I’d left the default folder as the Mac instead of the Windows equivalent.
  • Other tweaks were also done to the Configuration form to ensure it doesn’t go pear-shaped when you delete a template you have added.

Source code

As per usual, the full VBA source code is also available.

Dev Tool Plug

Finally, a quick plug for a development tool that’s helped me out a lot during this version’s coding. The purchase of MZ-Tools has been very, very useful. Whilst a lot of functions are more orientated towards the .NET side of things – or my coding style – there is enough inside this tool to make developing in VBA a lot easier. It’s well worth the price that’s being asked.

New utility – RoboHelp Map ID Report to CSV add-in

I’ve released a stand-alone version of a function that was from an older version of the toolbox.

The code has been tidied up, CSV file writing added and some extra checks are now included. Load up the RoboHelp Map ID Report, click the Convert button and a .CSV file version will appear in the same folder as the source .RTF file you exported from RoboHelp.

It comes with an example RoboHelp Map IDs file so that you can try it out before using it.

I’m not sure what other options to add to this utility, or indeed if there’s anyone else out there in the world who would be able to use it! So get in touch via LinkedIn or email and let me know if you do use it and any improvements you think I can add to it.

As with all my code, it’s not protected and you can just right-click and open it in Word, then press ALT & F11 to view the full source code.