Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
livetohike livetohike is offline
external usenet poster
 
Posts: 53
Default HotKey/Macro that quotes current word

Is there a way to quickly put double quotes around the current word?

I would like a macro that will look at the current insertion point,
and if it is a word insert quotes at the beginning and end of the word.

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
CyberTaz CyberTaz is offline
external usenet poster
 
Posts: 1,348
Default HotKey/Macro that quotes current word

If you *never* have need to put the quotes around more than one word it
might be worth your while to have a macro with a keystroke assigned.
Otherwise you'd need a separate macro for a 2-word string, a 3-word string,
etc. Why not try this - I find it just as convenient:

Start at the *right end* of the word/string type your " then hit
Option+LeftArrow as many times as necessary (once per word) & type your
closing ". [Note: Unfortunately doesn't work as well in the opposite
direction because it grabs the ending space.]

HTH |:)
Bob Jones
[MVP] Office:Mac



On 8/16/07 4:28 PM, in article
, "livetohike"
wrote:

Is there a way to quickly put double quotes around the current word?

I would like a macro that will look at the current insertion point,
and if it is a word insert quotes at the beginning and end of the word.


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Herb Tyson [MVP] Herb Tyson [MVP] is offline
external usenet poster
 
Posts: 2,936
Default HotKey/Macro that quotes current word

What's "Option+LeftArrow"? Must be a Mac thing. :-)

If you don't mind selecting what you want quoted (be it a word, phrase,
etc.), the following macro will put [smart] quotes around the selection:

Sub QuoteIt()
Selection.Copy
Selection.TypeText Text:=Chr$(147) + Chr$(148)
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Paste
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

I have this assigned to Ctrl+Alt+", and use it frequently.

--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


"CyberTaz" wrote in message
.. .
If you *never* have need to put the quotes around more than one word it
might be worth your while to have a macro with a keystroke assigned.
Otherwise you'd need a separate macro for a 2-word string, a 3-word
string,
etc. Why not try this - I find it just as convenient:

Start at the *right end* of the word/string type your " then hit
Option+LeftArrow as many times as necessary (once per word) & type your
closing ". [Note: Unfortunately doesn't work as well in the opposite
direction because it grabs the ending space.]

HTH |:)
Bob Jones
[MVP] Office:Mac



On 8/16/07 4:28 PM, in article
, "livetohike"
wrote:

Is there a way to quickly put double quotes around the current word?

I would like a macro that will look at the current insertion point,
and if it is a word insert quotes at the beginning and end of the word.



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
CyberTaz CyberTaz is offline
external usenet poster
 
Posts: 1,291
Default HotKey/Macro that quotes current word

snip
What's "Option+LeftArrow"? Must be a Mac thing. :-)

snip

Senior Disorientation strikes again - you're absolutely right:-)

In WinWord it's Control+LeftArrow.

--
Regrets|:)
Bob Jones
[MVP] Office:Mac


  #5   Report Post  
Posted to microsoft.public.word.docmanagement
livetohike livetohike is offline
external usenet poster
 
Posts: 53
Default HotKey/Macro that quotes current word

On Aug 16, 8:15 pm, "Herb Tyson [MVP]" wrote:
What's "Option+LeftArrow"? Must be a Mac thing. :-)

If you don't mind selecting what you want quoted (be it a word, phrase,
etc.), the following macro will put [smart] quotes around the selection:

Sub QuoteIt()
Selection.Copy
Selection.TypeText Text:=Chr$(147) + Chr$(148)
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Paste
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

I have this assigned to Ctrl+Alt+", and use it frequently.

--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog:http://word2007bible.herbtyson.com
Web:http://www.herbtyson.com

"CyberTaz" wrote in message

.. .

If you *never* have need to put the quotes around more than one word it
might be worth your while to have a macro with a keystroke assigned.
Otherwise you'd need a separate macro for a 2-word string, a 3-word
string,
etc. Why not try this - I find it just as convenient:


Start at the *right end* of the word/string type your " then hit
Option+LeftArrow as many times as necessary (once per word) & type your
closing ". [Note: Unfortunately doesn't work as well in the opposite
direction because it grabs the ending space.]


HTH |:)
Bob Jones
[MVP] Office:Mac


On 8/16/07 4:28 PM, in article
. com, "livetohike"
wrote:


Is there a way to quickly put double quotes around the current word?


I would like a macro that will look at the current insertion point,
and if it is a word insert quotes at the beginning and end of the word.


Thanks Herb, that is a nice compromise. One addition would be nice.
Occasionally I accidentally invoke it when nothing is selected and it
throws a run time error on "Selection.Copy". It has been a very long
time since I code, but does VBA have an exception handling mechanism
to prevent this. Or a conditional that just returns when nothing is
selected?

BTW
Your solution got me thinking and I came up w/ the following one which
does not require the word to be selected, but has a problem when the
desired word comes at the end of sentence. See below:

test of quote at end of sentence.
With insertion point somewhere in the word sentence you get
"sentenc"e.

I see why. To get the quote in the right space for the normal case, I
need to backspace one character (to remove the ending space), but for
a word at end of sentence the backspace is not needed.

Thanks



  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default HotKey/Macro that quotes current word

On Sun, 26 Aug 2007 14:54:12 -0000, livetohike
wrote:

On Aug 16, 8:15 pm, "Herb Tyson [MVP]" wrote:
What's "Option+LeftArrow"? Must be a Mac thing. :-)

If you don't mind selecting what you want quoted (be it a word, phrase,
etc.), the following macro will put [smart] quotes around the selection:

Sub QuoteIt()
Selection.Copy
Selection.TypeText Text:=Chr$(147) + Chr$(148)
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Paste
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

I have this assigned to Ctrl+Alt+", and use it frequently.

--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog:http://word2007bible.herbtyson.com
Web:http://www.herbtyson.com


Thanks Herb, that is a nice compromise. One addition would be nice.
Occasionally I accidentally invoke it when nothing is selected and it
throws a run time error on "Selection.Copy". It has been a very long
time since I code, but does VBA have an exception handling mechanism
to prevent this. Or a conditional that just returns when nothing is
selected?

BTW
Your solution got me thinking and I came up w/ the following one which
does not require the word to be selected, but has a problem when the
desired word comes at the end of sentence. See below:

test of quote at end of sentence.
With insertion point somewhere in the word sentence you get
"sentenc"e.

I see why. To get the quote in the right space for the normal case, I
need to backspace one character (to remove the ending space), but for
a word at end of sentence the backspace is not needed.

Thanks


It is possible to use error trapping -- put the statement

On Error GoTo Bye

before the Selection.Copy, and put the "statement label"

Bye:

just before the End Sub. However, there's a better way, which not only
avoids this error, but prevents the macro from putting quotes around a
graphic or some other non-text selection. Put the statement

If Selection.Type = wdSelectionNormal Then

before the Selection.Copy, and put the statement

End If

just before the End Sub.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Herb Tyson [MVP] Herb Tyson [MVP] is offline
external usenet poster
 
Posts: 2,936
Default HotKey/Macro that quotes current word

I seldom use error trapping for my own macros (keep forgetting that tastes
vary)... I like being reminded that what I'm using is a macro rather than a
built-in command. Go figure... For stuff I write for clients, however, I
usually include trapping just so it's less abrasive. That one, I copied from
my VBA module without thinking about the fact that trapping was absent.

--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


"Jay Freedman" wrote in message
...
On Sun, 26 Aug 2007 14:54:12 -0000, livetohike
wrote:

On Aug 16, 8:15 pm, "Herb Tyson [MVP]" wrote:
What's "Option+LeftArrow"? Must be a Mac thing. :-)

If you don't mind selecting what you want quoted (be it a word, phrase,
etc.), the following macro will put [smart] quotes around the selection:

Sub QuoteIt()
Selection.Copy
Selection.TypeText Text:=Chr$(147) + Chr$(148)
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Paste
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub

I have this assigned to Ctrl+Alt+", and use it frequently.

--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog:http://word2007bible.herbtyson.com
Web:http://www.herbtyson.com


Thanks Herb, that is a nice compromise. One addition would be nice.
Occasionally I accidentally invoke it when nothing is selected and it
throws a run time error on "Selection.Copy". It has been a very long
time since I code, but does VBA have an exception handling mechanism
to prevent this. Or a conditional that just returns when nothing is
selected?

BTW
Your solution got me thinking and I came up w/ the following one which
does not require the word to be selected, but has a problem when the
desired word comes at the end of sentence. See below:

test of quote at end of sentence.
With insertion point somewhere in the word sentence you get
"sentenc"e.

I see why. To get the quote in the right space for the normal case, I
need to backspace one character (to remove the ending space), but for
a word at end of sentence the backspace is not needed.

Thanks


It is possible to use error trapping -- put the statement

On Error GoTo Bye

before the Selection.Copy, and put the "statement label"

Bye:

just before the End Sub. However, there's a better way, which not only
avoids this error, but prevents the macro from putting quotes around a
graphic or some other non-text selection. Put the statement

If Selection.Type = wdSelectionNormal Then

before the Selection.Copy, and put the statement

End If

just before the End Sub.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.


  #8   Report Post  
Posted to microsoft.public.word.docmanagement
livetohike livetohike is offline
external usenet poster
 
Posts: 53
Default HotKey/Macro that quotes current word

On Aug 26, 11:38 am, Jay Freedman wrote:
On Sun, 26 Aug 2007 14:54:12
wrote:



On Aug 16, 8:15 pm, "Herb Tyson [MVP]" wrote:
What's "Option+LeftArrow"? Must be a Mac thing. :-)


If you don't mind selecting what you want quoted (be it a word, phrase,
etc.), the following macro will put [smart] quotes around the selection:


Sub QuoteIt()
Selection.Copy
Selection.TypeText Text:=Chr$(147) + Chr$(148)
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Paste
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub


I have this assigned to Ctrl+Alt+", and use it frequently.


--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog:http://word2007bible.herbtyson.com
Web:http://www.herbtyson.com


Thanks Herb, that is a nice compromise. One addition would be nice.
Occasionally I accidentally invoke it when nothing is selected and it
throws a run time error on "Selection.Copy". It has been a very long
time since I code, but does VBA have an exception handling mechanism
to prevent this. Or a conditional that just returns when nothing is
selected?


BTW
Your solution got me thinking and I came up w/ the following one which
does not require the word to be selected, but has a problem when the
desired word comes at the end of sentence. See below:


test of quote at end of sentence.
With insertion point somewhere in the word sentence you get
"sentenc"e.


I see why. To get the quote in the right space for the normal case, I
need to backspace one character (to remove the ending space), but for
a word at end of sentence the backspace is not needed.


Thanks


It is possible to use error trapping -- put the statement

On Error GoTo Bye

before the Selection.Copy, and put the "statement label"

Bye:

just before the End Sub. However, there's a better way, which not only
avoids this error, but prevents the macro from putting quotes around a
graphic or some other non-text selection. Put the statement

If Selection.Type = wdSelectionNormal Then

before the Selection.Copy, and put the statement

End If

just before the End Sub.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.


OK, this is looking pretty good now.
I now I am getting bit greedy, but ...
Sometimes I make a mistake (can you believe that) and want to 'undo'
the quoting. Instinct has me 'Undo' (Ctrl-Z) and go on typing. But
the undo cuts the selection leaving a pair of quotes (""). A second
undo 'undo' is required to replace the quotes w/ the original selected
word. Looking at the code I understand why this happens, but of
course the macro makes it feel like a single action, and a single undo
would be really nice. Not sure if this is asking two much of VBA, but
thanks a heap either way.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to apply bold to text in quotes Jacqui Formatting Long Documents 2 May 9th 07 02:54 PM
Save As Macro with current date jlawson Microsoft Word Help 2 July 19th 06 06:36 PM
Create macro how to change smart quotes "" with smart quotes ,,"? [email protected] Microsoft Word Help 8 March 4th 06 07:08 AM
Using current selection in a word macro sebFlyte Microsoft Word Help 1 July 6th 05 04:22 PM
Can Word be set-up to change curly quotes to straight quotes when. K&D'smom Microsoft Word Help 4 February 19th 05 08:06 AM


All times are GMT +1. The time now is 04:12 AM.

Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"