Hi all,
Thanks for all the replies so far.
To answer some of the points raised:
Tony: the code runs fine up to the point where it creates a Word document with an empty 3-column table on it where the 3 columns are of equal width. When I run it through the debugger, the code stops executing at the first line that tries to amend a column width, ie
TableObj.Columns(1).Width = 260
Killian: the 'and so forth...' bit that I mentioned in my original post is just code that prints some text at the top of the page before the table is printed, so I can't imagine it's doing any harm.
The other thing I notice is that when I run the code and get this error, it seems to take longer for the table to appear that it does when it's working properly. Not sure if that is significant or not.
Mr. Doubtfire: I don't have anything in my code at the minute like these lines from your code:
Set objApp = Nothing
Set Tbl1 = Nothing
Could that be causing a problem? Having said that, the thing that drives me up the wall is that this my code WAS working fine and now isn't. It's the unpredictability that's so annoying! I have 3 similar agents that produce similar 3-column tables for 3 different scenarios. Either they all work or none of them does. If anyone has any more ideas, I'd love to hear them. Thanks!