atw: Re: Word macro help

  • From: Howard Silcock <howard.silcock@xxxxxxxxx>
  • To: "austechwriter@xxxxxxxxxxxxx" <austechwriter@xxxxxxxxxxxxx>
  • Date: Wed, 3 Dec 2014 22:02:33 +1100

> I was thinking how elegant Howard’s version was compared to mine!
Well, that's music to my ears! But you'd have to agree that there's really
not much difference in approach. You added lots of explanatory stuff - and
an extra variable.

> I’m not sure why Howard’s version was deleting the text
Well, I'm quite baffled. I did test it. Did you try running it, by any
chance? I'll be reassured if it works for you!

Regards

Howard


On 3 December 2014 at 20:39, Suzy Davis <suzy.davis@xxxxxxxxxxxxxxxxx>
wrote:

> Hi Geoffrey, Howard
>
>
>
> Like Howard, I’m not sure why Howard’s version was deleting the text.  I
> was thinking how elegant Howard’s version was compared to mine!
>
>
>
> I did test mine, it didn’t delete the text – you should be able to use it
> without it deleting the selection!
>
>
>
>
>
> Kind regards Suzy
>
>
>
> *Suzy Davis *
> *Microsoft Word Templates, Apps for Microsoft Office*
>
> *& Documentation Projects*
>
> *Email* suzy.davis@xxxxxxxxxxxxxxxxx
>
>
>
> *From:* austechwriter-bounce@xxxxxxxxxxxxx [mailto:
> austechwriter-bounce@xxxxxxxxxxxxx] *On Behalf Of *Howard Silcock
> *Sent:* Wednesday, 3 December 2014 6:06 PM
> *To:* austechwriter@xxxxxxxxxxxxx
> *Subject:* atw: Re: Word macro help
>
>
>
> Ok
>
>
>
> Howard
>
> On Wednesday, 3 December 2014, Geoffrey <geoffrey@xxxxxxxxxxxxxx> wrote:
>
> Thanks for your efforts Howard. With a client breathing down my neck, I
> haven’t time to explore this. I’m running with what works and when I have a
> second to scratch my derriere I might return to the issue. Then again, I
> might count the hairs on my head and decide not to!
>
>
>
> Cheers
>
>
>
> Geoffrey Marnell
>
> Principal Consultant
>
> Abelard Consulting Pty Ltd
>
> P: 03 9596 3456
>
> M: 0419 574 668
>
> F: 03 9596 3625
>
> Web: www.abelard.com.au
>
>
>
> *From:* austechwriter-bounce@xxxxxxxxxxxxx [mailto:
> austechwriter-bounce@xxxxxxxxxxxxx] *On Behalf Of *Howard Silcock
> *Sent:* Wednesday, 3 December 2014 5:36 PM
> *To:* austechwriter@xxxxxxxxxxxxx
> *Subject:* atw: Re: Word macro help
>
>
>
> Hmm, this I don't understand! It worked fine for me (and in essence is the
> same as Suzy's). ​Did you copy and paste it into your VB Editor? (I'm
> wondering if there may be a typo introduced.)
>
>
>
> Howard
>
>
>
> On 3 December 2014 at 17:26, Geoffrey <geoffrey@xxxxxxxxxxxxxx> wrote:
>
> Hi Howard,
>
>
>
> Thanks for the code, but it just deletes the text I have selected. More
>  MS mischief, perhaps?
>
>
>
> Cheers
>
>
>
> Geoffrey Marnell
>
> Principal Consultant
>
> Abelard Consulting Pty Ltd
>
> P: 03 9596 3456
>
> M: 0419 574 668
>
> F: 03 9596 3625
>
> Web: www.abelard.com.au
>
>
>
> *From:* austechwriter-bounce@xxxxxxxxxxxxx [mailto:
> austechwriter-bounce@xxxxxxxxxxxxx] *On Behalf Of *Howard Silcock
> *Sent:* Wednesday, 3 December 2014 5:07 PM
>
>
> *To:* austechwriter@xxxxxxxxxxxxx
> *Subject:* atw: Re: Word macro help
>
>
>
> ​Hi Geoffrey
>
>
>
> I may be a poor businessman, but I don't think it's worth a fee. (But keep
> me in mind if you have something more substantial!)
>
>
>
> Sub WrapLaTexCodes()
>     With Selection.Range
>         .Text = "\(" & .Text & "\)"
>     End With
> End Sub
>
>
>
> Howard
>
>
>
>
>
> On 3 December 2014 at 16:43, Geoffrey <geoffrey@xxxxxxxxxxxxxx> wrote:
>
> Hi Howard
>
>
>
> Is it possible with VBA to wrap selected text in some specified characters?
>
>
>
> The background is this: I have a lot of mathematics that is partially
> Latex-compliant, but I need to insert the opening Latex characters (\() and
> the closing Latex characters {\)). For example, I have 3^x-2 in the
> manuscript and I want quickly change that to \(3^x-2\). It would be good if
> I could just select 3^x-2, press a key combination and get \(3^x-2\).
>
>
>
> Is this do-able? What fee would you charge for designing the macro?
>
>
>
> Cheers
>
>
>
> Geoffrey Marnell
>
> Principal Consultant
>
> Abelard Consulting Pty Ltd
>
> P: 03 9596 3456
>
> M: 0419 574 668
>
> F: 03 9596 3625
>
> Web: www.abelard.com.au
>
>
>
> *From:* austechwriter-bounce@xxxxxxxxxxxxx [mailto:
> austechwriter-bounce@xxxxxxxxxxxxx] *On Behalf Of *Howard Silcock
> *Sent:* Wednesday, 3 December 2014 10:06 AM
> *To:* austechwriter@xxxxxxxxxxxxx
> *Subject:* atw: Re: Word macro help
>
>
>
> Try replacing .Wrap = wdFindAsk with .Wrap = wdFindStop
>
>
>
> ​Howard
>
>
>
> On 3 December 2014 at 09:23, Geoffrey <geoffrey@xxxxxxxxxxxxxx> wrote:
>
> Hi austechies
>
>
>
> I’m stuck with a Word macro. All I want to do is have = replaced by &amp;=
> in a selection of text. This is the code that the record macro command
> generates:
>
>
>
> Sub equals()
>
> '
>
> ' equals Macro
>
> '
>
> '
>
>     With Selection.Find
>
>         .ClearFormatting
>
>         .Replacement.ClearFormatting
>
>         .Text = "="
>
>         .Replacement.Text = "&amp;="
>
>         .Forward = True
>
>         .Wrap = wdFindAsk
>
>         .Format = False
>
>         .MatchCase = False
>
>         .MatchWholeWord = False
>
>         .MatchWildcards = False
>
>         .Execute Replace:=wdReplaceAll
>
> End With
>
> End Sub
>
>
>
> The problem is that this macro replaces = with &amp;= throughout the
> entire rest of the document, not just in the text selected. That’s not what
> I want.
>
>
>
> Any ideas?
>
>
>
>
>
> Geoffrey Marnell
>
> Principal Consultant
>
> Abelard Consulting Pty Ltd
>
> P: 03 9596 3456
>
> M: 0419 574 668
>
> F: 03 9596 3625
>
> Web: www.abelard.com.au
>
>
>
>
>
>
>
>
>
>

Other related posts: