Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word: Save as text - use straight quotes instead of curly 2

Status
Not open for further replies.

dodge20

MIS
Jan 15, 2003
1,048
US
Is there a way for word to use the straight quotes instead of smart quotes when you save it as a plain text file. I receive the word doc from a client and save it out as text, so the autoformat option doesn't work. I have been doing a global replace, but would like it to happen at the save. Is it possible?

Thanks

Dodge20
 
Try typing "curly quotes" into Help. Help actually has a lot of....help. The item for "curly quotes' in Help tells you how to turn these on, and off.

Also, when you post, could you please state the version of the application you are asking about? In fact, you may NOT get the help you need from Help, depending on your version.

So, please state version, so we can suggestion things tailored to yuor situation.

If you can't find what you need using Help, post back. But try Help first. Thanks.

Gerry
 
Sorry it was Word XP (2002)

The help doesn't have anything the helps me.

Dodge20
 
This is a cut and paste directly from Help - Word XP 2002. I typed "curly quotes" into Help, and pressed Enter.

Change curly quotes to straight quotes and vice versa
Microsoft Word automatically changes straight quotation marks ( ' or " ) to curly (smart or typographer's) quotes ( or ) as you type.

To turn this feature on or off:

On the Tools menu, click AutoCorrect Options, and then click the AutoFormat As You Type tab.
Under Replace as you type, select or clear the "Straight quotes" with "smart quotes" check box.
Note You can find and replace all instances of single or double curly quotes with straight quotes in your document. To do this, clear the "Straight quotes" with "smart quotes" check box on the AutoFormat As You Type tab. On the Edit menu, click Replace. In both the Find what and Replace with boxes, type ' or ", and then click Find Next or Replace All.

To replace all straight quotes with curly quotes, select the "Straight quotes" with "smart quotes" check box, and repeat the find and replace procedure.

I just did a test following the above....the text file was saved as with straight quotes.

Did you actually try it? I am using Word XP as well and it works exactly as Help states it does. You wrote that:
The help doesn't have anything the helps me.
I DID try it, and it seems to work....actually, it does not seem to work...it does work.

Could you state precisely what steps you took and maybe we can figure out what the problem is.

Gerry
 
This doesn't work for me because I am not actually typing this. We get a bunch of word documents that we need to convert to txt files so they can be loaded onto a unix server. I don't think word has this capability and am guessing I will have to use visual basic.

Unless you have any other ideas.

Dodge20
 

If your document already has curly quotes, there isn't really any option other than a global replace.

You can, if you want, automate it by writing a macro to do the global replace and then save as a text file - I presume (but haven't tried) recording yourself doing it manually would give you a good start on the coding required.

When you have the necessary code you could use it stand alone or you ought to be able to incorporate it into the Save routine - although I doubt there's a gain and would imagine a hot key or a toolbar icon to a separate routine would be the better option.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
why not write a sed script to search/replace the files once on the UNIX server?


Kind Regards
Duncan
 
Ok, how do I get the macro to read the curly quotes. This is what I created, but it doesn't read the curly quotes correctly.

Code:
Sub EditQuotes()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = """"
        .Replacement.Text = """"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = """"
        .Replacement.Text = """"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "'"
        .Replacement.Text = "'"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

duncdude - sorry i don't know enough about unix to make that sed happen.

Dodge20
 
I was able to fix it. I had to paste the curly quotes from the web and then they pasted as curly in the macro. Weird.

Code:
Sub EditQuotes()
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "”"
        .Replacement.Text = """"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "“"
        .Replacement.Text = """"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "’"
        .Replacement.Text = "'"
        .Forward = True
        .Wrap = wdFindAsk
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Dodge20
 
Hi dodge20,

Better to use explicit character values than chance on cutting and pasting this sort of character ..

Curly left single quote = ChrW(8216)
Curly right single quote = ChrW(8217)
Curly left double quote = ChrW(8220)
Curly right double quote = ChrW(8221)


Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Excuse me....but is anyone reading the Help I posted? It clearly states how to replace all of the existing curly quotes/

Let me repeat that since it seems to have been missed.

Help clearly states how to replace existing curly quotes with straight one.

Not only that...but I actually followed the information, and hey presto people...it works. For XP...which was the version posted.

What seems to be the problem? I know I am sounding peeved, but...really, it works. Here it is again.

Note You can find and replace all instances of single or double curly quotes with straight quotes in your document. To do this, clear the "Straight quotes" with "smart quotes" check box on the AutoFormat As You Type tab. On the Edit menu, click Replace. In both the Find what and Replace with boxes, type ' or ", and then click Find Next or Replace All.

No macros, no code. It works for existing files;

dodge20, you wrote:
This doesn't work for me because I am not actually typing this.

Please actually READ what I posted, and READ what is in Help, because it IS in Help, and it has nothing to do with if you are typing it or not. How can you possibly say it does not work for you because you are not actually typing it???? That simply indicates you did not read it, and did not try it.

You original question could have been easily answered by, as I suggested, using Help because the answer is there. You can change all curly quotes to straight. "It does not work as I am not typing"....that is out right nonsense, and b.s.....you did not try. Why? It DOES work. I have tested on a dozen document...oh, I don't know just to see if there was some odd strange thing that made it not work. Gosh...it DOES work.

As for the rest of you...what is the problem? I see all this code posted for nothing. I am shaking my head.

Gerry
 

Guilty as charged!

Smacked wrist for me.
Star for you.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Hi Tony.....in my original rant above, I actually named you...but took it out as going too far. The shaking of head was actually in your direction, as I was truly surprised.

This was a simple thing, with the answer right there in Help. All the other stuff is totally superfluous.

Unless of course the requirement is to run code to process a lot of files in one operation. In which case, yes, code would do it. However, that was not what was asked.

BTW: while not mentioned in the Help text, curly quotes have, of course, left and right styles. When you do a Replace, you only need to do one Replace. It replaces both left and right...as of course straight quotes do not have left or right.

Gerry
 
You are absolutely right. I did not properly read the help text you quoted - I assumed I knew what it said [blush]

I was completely unaware of this aspect of Find and Replace (it does seem rather obscure that AutoFormat As you Type can have a post hoc effect) and it makes me wonder what else there might be in similar vein. I note that it works in reverse to replace straight quotes with matching pairs of curly quotes but doesn't seem to work with other Autoformat oprions (superscripted ordinals, etc.)

Of course, if code is wanted the way to do it is to set the AutoFormat option, then do a single Replace operation and then set the Autoformat option back to what it was.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
You are a very gracious man. Clearly you are not the only one who did not actually read the posts. Thank you. It was getting frustrating with all these posts and comments about not working, and all this "other" stuff...when the answer was simple and readily available. All I did was type "curly quotes" into Help, and there it was. And it worked. To have this apparently completely ignored was, well frustrating.

I understand, we read these things and mostly skim, thinking we know what is being said. This is why I make a deliberate effort to truly read exactly what is written, and also try to clearly write replies responding to what is actually written.

True, it does seem an obscure aspect of Replace - but then.....this IS Word, and you know as well as I do that there are some, hmmmm, odd approaches within Word.

Have a good one!

Gerry
 
fumei -

I have tried that help before you posted it, and for some reason it doesn't work on my computer. The only way I could get it to work was to write the VB. Maybe I need a reinstall of office.

Dodge20
 
dodge20

I have tried that help before you posted it, and for some reason it doesn't work on my computer.

Unclear.

1. Is this saying you tried to use Help before you posted, and could not get Help? Answer: Not all is installed on a standard Office install. However, normally Word Help is. Please clarify if the issue is you could not get Help.

2. Is this saying you DID try Help, got the answer I copied from there, DID try what Help (and I) suggested to do and it did not work? Response: this is from Post #4 (of now...what 15 of them?), and I reiterate the request.
Could you state precisely what steps you took and maybe we can figure out what the problem is.

Again, please state precisely what steps you took and maybe we can figure out what the problem is.

I have now tried this process on 17 different computers, and on ALL of them.....it works. So please, I am definitely curious, describe what you DID do. No assumptions about what "will" or will not work. What did you actually do? maybe there are other issues I am not aware of.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top