Hiya,

I have a mergefield which I am dynamically replacing with a link in my code.
Even though the link says "\* MERGEFORMAT", it still does not retain
formatting when embedded in the document. So, I'm having to change its
formatting after it has been embedded.

So basically, how can I say something like myLink.Formatting =
myMergeField.Formatting - so that the embedded link has the same
font/formatting etc. as the mergefield I'm replacing with it.

Thanks



Robin

Re: Apply formatting taken from one object to another? by Helmut

Helmut
Mon Oct 18 07:20:48 CDT 2004

Hi Robin,
maybe this is sufficient:
Selection.CopyFormat
' do what you like
Selection.PasteFormat
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000


Re: Apply formatting taken from one object to another? by Robin

Robin
Mon Oct 18 07:35:56 CDT 2004

Can this be done without Copy/Paste? I'm definately not using the clipboard
or application selection for any of my VBA stuff - really bad practice
unless the user is running macros (in this case, I'm automating report
generation, the user could be be working on a Word document while the report
is being generated, so I cannot assume the active document is the one I'm
hoping it is).

"Helmut Weber" <anonymous@discussions.microsoft.com> wrote in message
news:190801c4b50c$e66a07c0$a401280a@phx.gbl...
> Hi Robin,
> maybe this is sufficient:
> Selection.CopyFormat
> ' do what you like
> Selection.PasteFormat
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
>



Re: Apply formatting taken from one object to another? by Helmut

Helmut
Mon Oct 18 08:12:09 CDT 2004

Hi Robin,
I don't think that copyformat uses
the clipboard a tall. At least,
it seems to have no effect
on the contents of the clipboard.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000

Re: Apply formatting taken from one object to another? by Robin

Robin
Mon Oct 18 08:24:50 CDT 2004

Well even so, it only applies to the Selection object, which I cannot use as
it is tied to the active document.

"Helmut Weber" <anonymous@discussions.microsoft.com> wrote in message
news:142a01c4b514$12a9d570$a301280a@phx.gbl...
> Hi Robin,
> I don't think that copyformat uses
> the clipboard a tall. At least,
> it seems to have no effect
> on the contents of the clipboard.
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000



Re: Apply formatting taken from one object to another? by Helmut

Helmut
Mon Oct 18 08:45:14 CDT 2004

Hi,
just one more idea:
Dim oDoc As Document
Set oDoc = Documents("farben.doc")
Dim fnt As Font
Set fnt = oDoc.Paragraphs(3).Range.Font.Duplicate
oDoc.Paragraphs(1).Range.Font = fnt
Thanks to Martin Seelhofer
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000


Re: Apply formatting taken from one object to another? by Robin

Robin
Mon Oct 18 08:59:57 CDT 2004

Yes, that would work for the font. I suppose I'll have to just go through
all formatting options in the source and set them in the destination like
this.

Thanks.

"Helmut Weber" <anonymous@discussions.microsoft.com> wrote in message
news:0c9c01c4b518$b1eedb40$a501280a@phx.gbl...
> Hi,
> just one more idea:
> Dim oDoc As Document
> Set oDoc = Documents("farben.doc")
> Dim fnt As Font
> Set fnt = oDoc.Paragraphs(3).Range.Font.Duplicate
> oDoc.Paragraphs(1).Range.Font = fnt
> Thanks to Martin Seelhofer
> ---
> Greetings from Bavaria, Germany
> Helmut Weber, MVP
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
>