Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2014, 08:47 AM
Smallweed Smallweed is offline Inserted AutoText table incorrectly formatted - unless macro paused! Windows 7 64bit Inserted AutoText table incorrectly formatted - unless macro paused! Office 2010 32bit
Novice
Inserted AutoText table incorrectly formatted - unless macro paused!
 
Join Date: Aug 2013
Posts: 13
Smallweed is on a distinguished road
Default Inserted AutoText table incorrectly formatted - unless macro paused!

Hi,

I have some code that worked fine in Word 2003 but is going wrong in 2010. It just adds an autotext entry into the document: a single cell table. This table has been formatted to have:
PreferredWidthType = wdPreferredWidthPercent and
PreferredWidth = 100
When VBA is used to insert this autotext table inside another table (which happens all the time as the document is formatted as a two-column table), the preferred width type reverts to wdPreferredWidthPoints and becomes too wide. The strange thing is that if I put a breakpoint or a Stop ANYWHERE in this code and then run and resume the macro, all is well. Is this some kind of refresh issue? I've tried putting a Sleep delay AFTER the line that inserts the autotext into the code but curiously the table only gets inserted after the delay. I've tried also putting code that explicitly changes the preferred width options to percent/100 after the Sleep delay and this is ignored.
Any ideas gratefully received...
Reply With Quote
  #2  
Old 01-14-2014, 03:40 PM
NeilSC NeilSC is offline Inserted AutoText table incorrectly formatted - unless macro paused! Windows 7 64bit Inserted AutoText table incorrectly formatted - unless macro paused! Office 2013
Novice
 
Join Date: Dec 2013
Posts: 24
NeilSC is on a distinguished road
Default

I think it might work if you include the paragraph mark immediately after the one-cell table when you create the AutoText entry for it. (It may be necessary to format both the table and the cell with a preferred width of 100%.) But you will then also have to delete that paragraph mark ever time after inserting it in a document.
Reply With Quote
  #3  
Old 01-15-2014, 09:03 AM
Smallweed Smallweed is offline Inserted AutoText table incorrectly formatted - unless macro paused! Windows 7 64bit Inserted AutoText table incorrectly formatted - unless macro paused! Office 2010 32bit
Novice
Inserted AutoText table incorrectly formatted - unless macro paused!
 
Join Date: Aug 2013
Posts: 13
Smallweed is on a distinguished road
Default

Thanks for the tip but unfortunately it still doesn't work. It seems to be more fundamental to the way the VBA is running. If I put a break point after the AutoText insertion line and just resume the macro after it stops, the table inserts with the correct preferred width settings. Similarly if I put some code that intentionally errors, e.g.
For lngCtr = 1 To 10000000000#
Next
(this causes an overflow error)
if I then click out of the error message, all is well. Very strange
Reply With Quote
  #4  
Old 01-15-2014, 03:32 PM
NeilSC NeilSC is offline Inserted AutoText table incorrectly formatted - unless macro paused! Windows 7 64bit Inserted AutoText table incorrectly formatted - unless macro paused! Office 2013
Novice
 
Join Date: Dec 2013
Posts: 24
NeilSC is on a distinguished road
Default

With my Word 2013, I never get an error message (or thrown into the VBA Editor without an error message) when running the macro to insert an AutoText entry consisting of a one cell table, so there is no reason for me to put in a break point or delay.

I have a couple of other thoughts though.

Maybe the cached copy of your macro template has become corrupted and needs to be re-cached.

In Word 2013, the preferred code is to use .BuildingBlockEntries property instead of the .AutoTextEntries property ... so if your macro uses .AutoTextEntries you might want to see if .BuildingBlockEntries works better ... I doubt it will though, since .AutoTextEntries works equally well on my Word 2013.
Reply With Quote
  #5  
Old 01-16-2014, 03:15 PM
macropod's Avatar
macropod macropod is offline Inserted AutoText table incorrectly formatted - unless macro paused! Windows 7 32bit Inserted AutoText table incorrectly formatted - unless macro paused! Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Smallweed,

It would be helpful if you could attach a document to a post containing both the autocorrect entry the table you're trying to insert it into and the code you're using. You can do this via the paperclip symbol on the 'Go Advanced' tab.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserted AutoText table incorrectly formatted - unless macro paused! Picture inserted in table not visible - Again peytontodd Word 5 11-12-2013 07:04 AM
Inserted AutoText table incorrectly formatted - unless macro paused! Picture inserted in cell of table is not visible peytontodd Word 1 12-07-2012 08:36 PM
Numbered List paragraph style prints out incorrectly when converted to PDF - Help! kimrussell68 Word 0 02-02-2010 07:58 AM
Maintaining AUtotext Entries from an external table. kelzud Word Tables 0 07-28-2009 01:31 PM
Insert formatted table into word (mail merge) manojbmsce Mail Merge 0 09-25-2008 02:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft