[AccessD] Help With Word Basic

Andy Lacey andy at minstersystems.co.uk
Sun May 16 11:39:25 CDT 2004


Bryan, you are a Word genius. Will try this tomorrow but don't doubt it'll
work if you say it does. My ConvertToText after pasting does work, but tgis
would be far more elegant. Thanks.

-- Andy Lacey
http://www.minstersystems.co.uk 

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com 
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of 
> Bryan Carbonnell
> Sent: 16 May 2004 16:25
> To: Access Developers discussion and problemsolving
> Subject: Re: [AccessD] Help With Word Basic
> 
> 
> On 14 May 2004 at 14:43, Andy Lacey wrote:
> 
> > can do it manually but can't for the life of me see how to do it in 
> > code. The selection object has a Text property, but you can't Copy 
> > that, and even if you could I don't know what that would do 
> with the 
> > embedded merge field. Can someone (Bryan for example?) 
> help? Where am 
> > I going wrong. I always have this kind of trouble with Word Basic, 
> > it's a nightmare unless you've got an example to work from.
> 
> I don't use mail merge very often. I don't like it. So I may not be 
> the best person to help :(
> 
> I can duplicate what you are describing, but I can't select just the 
> text. It's quite bizare. 
> 
> Tick, tock. Tick, Tock....
> 
> Well now after messing around some more I have a solution.
> 
> What you need to do is reduce the range's size by 1 chartacter, which 
> takes the cell marker out of the rang that you will be copying. 
> Here's some code to show what I mean(and as always watch for wrap):
> 
> Sub test()
>   Dim doc As Document
>   Dim cl As Cell
>   Dim rngCL As Range
>   Dim pasteDoc As Document
>   
>   'Get the document with the table
>   Set doc = ActiveDocument
>   'Get the Cell
>   Set cl = doc.Tables(1).Cell(1, 2)
>   'Set the range to the cell
>   Set rngCL = cl.Range
>   'Move the range's end point back one
>   rngCL.End = rngCL.End - 1
>   'Now copy
>   rngCL.Copy
>   'Get the doc where you will paste into
>   Set pasteDoc = Documents.Add
>   'Paste
>   pasteDoc.Range.Paste
>   
>   'Close and release objects
>   Set pasteDoc = Nothing
>   Set cl = Nothing
>   Set rngCL = Nothing
>   Set doc = Nothing
> End Sub
> 
> -- 
> Bryan Carbonnell - carbonnb at sympatico.ca
> I don't suffer from insanity, I enjoy every minute of it.
> 
> 
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com 
> http://databaseadvisors.com/mailman/listinfo/a> ccessd
> Website: 
> http://www.databaseadvisors.com
> 
> 




More information about the AccessD mailing list