Author-it Tips and Tricks

A short tutorial showing how to create an AfterPublish macro to detach the template from the published Word document.

This is my first video tutorial so I would appreciate any feedback you have about it. Either leave a comment (below this article) or send me an email.

After installing a bunch of Windows updates, when publishing to Word 2007, I get the following errors in the log:

  • Document cannot be opened by word. Error: Could not change document template.
  • Publishing failed due to an Error: Exception from HRESULT: 0X800A01A8

Not having much time because of a deadline, I performed a "System Restore Point" to before the Windows updates and the publishing works again.

After looking at it again today, it appears to be the Windows update KB956358 (Update to Microsoft Word 2007). I installed all of the other updates except this one and was able to publish using Author-it. Then I installed KB956358 and got the same error when publishing.

After more testing, it looks like the problem only exists for templates that are on network drives. That is, if my book object has a Word Template that is located on a network drive, it fails. If the same template is on my local drive, it is fine. The only skerrick of info I could find that relates to this update and templates is this newsgroup posting. I didn’t try to digitally sign the template or anything.

[Friday, 19 December 2008] Did some testing on a Windows XP machine with Word 2003. Installed the corresponding update (KB956357) and published using a .dot template, and all worked OK. So must be either a Word 2007 and/or .dotm issue.

[Monday, 22 December 2008] After more testing... publishing using Word templates that are on network drives is OK (as reported by Tricia on the Author-it group). The only peculiarity of my setup is that we reference a separate Word macro template that contains all of our 'core' macros (macros that are shared by a number of customised templates). I removed this reference and it worked - this is the root of the problem. It appears that as part of the update, they have tightened which templates can be referenced, and apparently, templates on network drives cannot be referenced.

So now that I know the problem. I need to find a solution... There are a couple of options:

  1. Put all the macros in the main template (creates overhead to update core macros).
  2. Use a batch file to copy the core template to the Startup directory on the C: drive. The batch file could be called when a user logs on to the PC, or as part of the publishing profile.

Favouring option 2 at the moment.

[Monday, 29 December 2008] I have now implemented option 2. Specifically, I:

  1. Created a batch file that copies the common template to the user's c: drive.
    REM Copies templates required for Author-it publishing
    REM Create the temp directory, if it doesn't exist already.
    if not exist c:\temp md c:\temp
    copy "\\server\AuthorIT\Data\Templates\Templates\ait_publish.dotm" "c:\temp\"
  2. Added a 'Command Line' action to the Publishing Profile (in the 'Before Publishing' section) that calls the batch file created in step 1.
  3. Updated the publishing template to reference the 'c:\temp\ait_publish.dotm' template (instead of the copy on the server).

What this means is that an author is required to do nothing other than publish the document (that is, they don't need to manually run a batch file to get the latest templates, etc). Using a static directory (c:\temp) means the template will always be in the same location, irrespective of the user.

What is interesting is that Word will look in the user's Word startup directory (eg, c:\Documents and Settings\user\Application Data\Microsoft\Word\Startup) first and if the referenced template is in that directory, it will use that copy. Otherwise, it will look in the specifically reference directory (eg, c:\temp).

One day I will get around to documenting how to put the common macros in a 'core' template...

On the Auhtor-it server:

  1. Create a user group in Computer Management and add the users to the group that should be given access to Author-it.
  2. In SQL Server Management, create a user login in Security > Logins, then:
    1. Select the Windows Authentication option.
    2. Click the Search button.
    3. Click the Advanced button.
    4. Click the Object Types button.
    5. Select the Groups check box and click OK.
    6. Click the Find Now button.
    7. Select the group from the search results and click the OK button.
    8. Click OK.
    9. Click OK again.
  3. In SQL Server Management, create a user in Databases > [Database Name] > Security > Users and then:
    1. Right-click on Users and select New User...
    2. Enter a user name.
    3. Click the ... button next to the Login name field.
    4. Click the Browse button.
    5. Select the check box next to the user created in the previous steps and click OK.
    6. Click OK again.
    7. Select the check boxes next to the db_datareader and db_datawriter in the Database Role Permissions list box.
    8. Click OK.

Q: What happens if you include a link to a topic, but that topic isn't included in the book object?

A: If the link object has the Jump from anchor to option set to:

  • Same window (normal)
  • New window

the target topic must be included in the book object, otherwise, the link will not be resolved and the content will not be included in the HTML published output.

If the link object has any of the ther settings, the target topics will be included in the HTML output.

Internal codes:

1 = Same window

2 = New window

3 = Standard popup

4 = Expanding block

5 = Expanding inline

6 = Popup on click

7 = Popup on hove

Eliminate repetitive, mundane, and time-consuming tasks when publishing from Author-it Cloud

Find out more

Segue Consulting

Providing professional technical communication, Author-it consulting, and online communication services.

We are one of only two Author-it certified consultants in Australia.

Follow hamishblunck on Twitter