Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Wed, 07 Dec 2005 09:08:43 +1000,    group: microsoft.public.word.vba.addins        back       


Export Autotext Enties to a word table   
Hello,

I have a client with hundreds of custom autotext entires and they need
them exported to a word file table.

I have written code to do this and it works well. The only problem is
any formatting and images stored in the Autotext are lost.

Here is the code. Any ideas ? Being a novice at VBA, I would suggest the
issue is with Typetext or maybe the way I addressed the selection.

Thanks


Sub ExportAutotextEntries()
 

    Documents.Add
    
  
    ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=(2),_    
    NumColumns:=2,DefaultTableBehavior:=wdWord9TableBehavior,_
    AutoFitBehavior:=wdAutoFitFixed
 
    For Each i In ActiveDocument.AttachedTemplate.AutoTextEntries
 
        Selection.TypeText i.Name
        Selection.MoveRight Unit:=wdCell
        
        Selection.TypeText i.Value
        Selection.MoveRight Unit:=wdCell
 
    Next i
 
    MsgBox "Done"
 
End Sub
-- 
Regards,

Michael Jenkin
MCP MVP SBS
Australia

www.mickyj.com
date: Wed, 07 Dec 2005 09:08:43 +1000   author:   Michael Jenkin [SBS-MVP]

Re: Export Autotext Enties to a word table   
Hi Michael,

Instead of using I.value define I as AutotextEntry (not essential) and
replace the line with         I.Insert Where:=Selection.Range,
RichText:=True


Cheers
TonyS
date: 6 Dec 2005 15:07:57 -0800   author:   Tony Strazzeri

Re: Export Autotext Enties to a word table   
Its all been written. Try the add-in at 
http://word.mvps.org/FAQs/Customization/ExportAutocorrect.htm.
-- 
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
 --------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Michael Jenkin [SBS-MVP]"  wrote in message 
news:O6RbWXr%23FHA.504@TK2MSFTNGP12.phx.gbl...
> Hello,
>
> I have a client with hundreds of custom autotext entires and they need
> them exported to a word file table.
>
> I have written code to do this and it works well. The only problem is
> any formatting and images stored in the Autotext are lost.
>
> Here is the code. Any ideas ? Being a novice at VBA, I would suggest the
> issue is with Typetext or maybe the way I addressed the selection.
>
> Thanks
>
>
> Sub ExportAutotextEntries()
>
>
>    Documents.Add
>
>
>    ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=(2),_
>    NumColumns:=2,DefaultTableBehavior:=wdWord9TableBehavior,_
>    AutoFitBehavior:=wdAutoFitFixed
>
>    For Each i In ActiveDocument.AttachedTemplate.AutoTextEntries
>
>        Selection.TypeText i.Name
>        Selection.MoveRight Unit:=wdCell
>
>        Selection.TypeText i.Value
>        Selection.MoveRight Unit:=wdCell
>
>    Next i
>
>    MsgBox "Done"
>
> End Sub
> -- 
> Regards,
>
> Michael Jenkin
> MCP MVP SBS
> Australia
>
> www.mickyj.com
date: Tue, 6 Dec 2005 17:14:36 -0600   author:   Charles Kenyon

Re: Export Autotext Enties to a word table   
Thanks, I tried this one yesterday and the results were not quite what I
was after.

Thanks for the response. 

Charles Kenyon wrote:

> http://word.mvps.org/FAQs/Customization/ExportAutocorrect.htm

-- 
Regards,

Michael Jenkin
MCP MVP SBS
Australia

www.mickyj.com
date: Wed, 07 Dec 2005 09:48:54 +1000   author:   Michael Jenkin [SBS-MVP]

Re: Export Autotext Enties to a word table   
Absolutely wonderful.

If anyone else ever needs to do this, take a look at

Sub ExportAutotextEntries()
 

    Documents.Add
    
  
    ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=(2),
NumColumns:=2, DefaultTableBehavior:=wdWord9TableBehavior,
AutoFitBehavior:= _
    wdAutoFitFixed
 
    For Each I In ActiveDocument.AttachedTemplate.AutoTextEntries
    

        Selection.TypeText I.Name
        Selection.MoveRight Unit:=wdCell
    
        I.Insert Where:=Selection.Range, RichText:=True
        
        Selection.MoveRight Unit:=wdCell
 
    Next I
 
    MsgBox "Done"
 
End Sub


works a treat !

Tony Strazzeri wrote:

> Hi Michael,
> 
> Instead of using I.value define I as AutotextEntry (not essential) and
> replace the line with         I.Insert Where:=Selection.Range,
> RichText:=True
> 
> 
> Cheers
> TonyS
> 

-- 
Regards,

Michael Jenkin
MCP MVP SBS
Australia

www.mickyj.com
date: Wed, 07 Dec 2005 11:26:10 +1000   author:   Michael Jenkin [SBS-MVP]

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us