Jay
Wed Jun 30 11:45:51 CDT 2004
Hi Poster,
Do your queries contain "curly quotes" that curve in opposite directions at
the start and end of each word? If so, that's why Query Analyzer doesn't
recognize them -- they're actually different characters than the "straight
quote"/apostrophe.
To fix it up, first go to Tools > AutoCorrect > AutoFormat As You Type.
Clear the option to replace "straight quotes" with "smart quotes". (Only MS
thinks they're smart!)
Now open the Replace dialog. Type one apostrophe in both the Find What box
and the Replace With box, and click the Replace All button. All the curly
quotes of both varieties will be replaced with straight quotes. Try the
result in Query Analyzer.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org
Poster wrote:
> The only remaining problem is that when the resulting text is pasted
> into a Query Analyzer session, Query Analyzer doesn't recognise the
> apostrophes and so an error occurs when trying to run an SQL query.
> It seems that an apostrophe in Word is different to an apostrophe in
> Query Analyzer. Would any of you Microsoft guys ever have encountered
> this problem before?
>
>
> Jay Freedman wrote in message ...
>> Assuming the words are separated by paragraph marks (¶) and not
>> manual line breaks, this macro will do the job.
>>
>> Sub AddQuoteComma()
>> Dim oRg As Range
>> Set oRg = ActiveDocument.Range
>>
>> With oRg.Find
>> .ClearFormatting
>> .Replacement.ClearFormatting
>> .Text = "(<[!^13]{1,})^13"
>> .Replacement.Text = "'\1',^p"
>> .Forward = True
>> .Wrap = wdFindContinue
>> .Format = False
>> .MatchWildcards = True
>> .Execute Replace:=wdReplaceAll
>> End With
>>
>> 'remove final comma and paragraph mark
>> Set oRg = ActiveDocument.Range
>> With oRg
>> .Collapse wdCollapseEnd
>> .MoveStartUntil cset:=",", Count:=wdBackward
>> .MoveStart unit:=wdCharacter, Count:=-1
>> .Delete
>> End With
>>
>> Set oRg = Nothing
>> End Sub
>>
>>
>> "Poster" <Poster@hotmail.com> wrote:
>>
>>> Dudes,
>>>
>>> I would like to have a Word macro that can wrap quotes around each
>>> line of selected text, followed by a comma at the end of each line.
>>> Preferably it won't append a comma to the last line, but I'll
>>> settle for a solution without this extra feature.
>>>
>>> eg.
>>>
>>> Dog
>>> Cat
>>> Fish
>>> Bird
>>>
>>> becomes
>>>
>>> 'Dog',
>>> 'Cat',
>>> 'Fish',
>>> 'Bird'
>>>
>>>
>>> The reason I need this is to allow me to save a lot of time where I
>>> have to manually create an SQL query that includes a long list of
>>> search criteria.
>>>
>>> Thanks. The first to provide a solution goes to the top of the
>>> class!
>>>
>>> Poster
>>>
>>
>>
>> --
>> Regards,
>> Jay Freedman
>> Microsoft Word MVP FAQ:
http://www.mvps.org/word