Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
In Word 2007 I'm editing a paper which contains EndNote citation fields, and
in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
I am not sure what you mean by EndNote citation fields. If you use Alt+F9
to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
I am not sure what you mean by EndNote citation fields. If you use Alt+F9
to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Thanks for picking this up.
EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Thanks for picking this up.
EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
If you will tell me what appears when you toggle on the display of the field
codes AND where the space that you want to delete is located with respect to the { } field delimiters then I can probably help you. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
If you will tell me what appears when you toggle on the display of the field codes AND where the space that you want to delete is located with respect to the { } field delimiters then I can probably help you. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Word itself does not use fields for endnotes.The fields presumably are
inserted via your EndNote software, however quickly checking at Google there are several EndNote packages, hence Doug's request to learn exactly what your endnote software inserts that you wish to find. It is simple enough to locate fields using vba, provided you know what the field construction is. What exactly appears between the curly brackets {}? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org .. "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Word itself does not use fields for endnotes.The fields presumably are inserted via your EndNote software, however quickly checking at Google there are several EndNote packages, hence Doug's request to learn exactly what your endnote software inserts that you wish to find. It is simple enough to locate fields using vba, provided you know what the field construction is. What exactly appears between the curly brackets {}? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org .. "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? |
#10
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Thanks for all replies.
I avoided saying what's inside the curly brackets because when the fields are displayed they tend to be very long. But in the case of the EndNote citation fields, each one begins with "{ ADDIN EN.CITE EndNoteCite", followed by lots more stuff, and ending with "/Cite/EndNote}". Maybe there isn't a way to do wildcard find and replace for fields generically, and probably not something one would really need, but it would be handy to be able to use it with EndNote fields, which I frequently work with. A kind of workaround for me meanwhile is simply to Find each citation by jumping from one to the next using Browse by Field on the scrollbar, but it would save time to be able to Find AND Replace, and I would welcome a suggestion of code that could do it programatically. "Graham Mayor" wrote: Word itself does not use fields for endnotes.The fields presumably are inserted via your EndNote software, however quickly checking at Google there are several EndNote packages, hence Doug's request to learn exactly what your endnote software inserts that you wish to find. It is simple enough to locate fields using vba, provided you know what the field construction is. What exactly appears between the curly brackets {}? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org .. "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? . |
#11
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Thanks for all replies. I avoided saying what's inside the curly brackets because when the fields are displayed they tend to be very long. But in the case of the EndNote citation fields, each one begins with "{ ADDIN EN.CITE EndNoteCite", followed by lots more stuff, and ending with "/Cite/EndNote}". Maybe there isn't a way to do wildcard find and replace for fields generically, and probably not something one would really need, but it would be handy to be able to use it with EndNote fields, which I frequently work with. A kind of workaround for me meanwhile is simply to Find each citation by jumping from one to the next using Browse by Field on the scrollbar, but it would save time to be able to Find AND Replace, and I would welcome a suggestion of code that could do it programatically. "Graham Mayor" wrote: Word itself does not use fields for endnotes.The fields presumably are inserted via your EndNote software, however quickly checking at Google there are several EndNote packages, hence Doug's request to learn exactly what your endnote software inserts that you wish to find. It is simple enough to locate fields using vba, provided you know what the field construction is. What exactly appears between the curly brackets {}? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org .. "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? . |
#12
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Forgot to add that the space I wish to remove is any space that comes immediately before the first opening curly bracket (i.e. before the insertion point of the citation). Sometimes there is no space before the insertion point, in which case there's nothing I need to do. "Graham Mayor" wrote: Word itself does not use fields for endnotes.The fields presumably are inserted via your EndNote software, however quickly checking at Google there are several EndNote packages, hence Doug's request to learn exactly what your endnote software inserts that you wish to find. It is simple enough to locate fields using vba, provided you know what the field construction is. What exactly appears between the curly brackets {}? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org .. "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? . |
#13
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Forgot to add that the space I wish to remove is any space that comes
immediately before the first opening curly bracket (i.e. before the insertion point of the citation). Sometimes there is no space before the insertion point, in which case there's nothing I need to do. "Graham Mayor" wrote: Word itself does not use fields for endnotes.The fields presumably are inserted via your EndNote software, however quickly checking at Google there are several EndNote packages, hence Doug's request to learn exactly what your endnote software inserts that you wish to find. It is simple enough to locate fields using vba, provided you know what the field construction is. What exactly appears between the curly brackets {}? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org .. "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? . |
#14
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
The following macro should then work
Dim oField As Field Dim oRng As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Delete End If End If Next oField http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message news Forgot to add that the space I wish to remove is any space that comes immediately before the first opening curly bracket (i.e. before the insertion point of the citation). Sometimes there is no space before the insertion point, in which case there's nothing I need to do. "Graham Mayor" wrote: Word itself does not use fields for endnotes.The fields presumably are inserted via your EndNote software, however quickly checking at Google there are several EndNote packages, hence Doug's request to learn exactly what your endnote software inserts that you wish to find. It is simple enough to locate fields using vba, provided you know what the field construction is. What exactly appears between the curly brackets {}? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org .. "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? . |
#15
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
The following macro should then work
Dim oField As Field Dim oRng As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Delete End If End If Next oField http://www.gmayor.com/installing_macro.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message news Forgot to add that the space I wish to remove is any space that comes immediately before the first opening curly bracket (i.e. before the insertion point of the citation). Sometimes there is no space before the insertion point, in which case there's nothing I need to do. "Graham Mayor" wrote: Word itself does not use fields for endnotes.The fields presumably are inserted via your EndNote software, however quickly checking at Google there are several EndNote packages, hence Doug's request to learn exactly what your endnote software inserts that you wish to find. It is simple enough to locate fields using vba, provided you know what the field construction is. What exactly appears between the curly brackets {}? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org .. "David Newmarch" wrote in message ... Thanks for picking this up. EndNote bibliographical software, through the EndNote add-in for Word, inserts in-text bibliographical citations in a Word document as fields. I'm not concerned at this stage with modifying any fields, Switching to a different bibliographical style (not to be confused with Word's formatting styles) is a procedure that EndNote takes care without any difficulty. My problem is just with finding the fields so that I can delete the now-extraneous space (in the ordinary Word text, not the field) that in most instances exists immediately before the point where the field has been inserted. In other words I want to bring these fields up against the preceding text - where previously they were inserted with a space between them and the preceding text. But Word doesn't let me find ANY fields using wildcards. There are also other fields in the document, like hyperlinks and a table of Contents, and when Use Wildcards is checked ^d doesn't find them either. (Without Wildcards, ^d finds all of them.) When the field codes are displayed, all of them (the citation entries and the hyperlinks and what have you) are enclosed in the usual curly brackets. I also tried just searching for spaces before curly brackets, but Field Code brackets don't seem to be findable with Find and replace. Does this information help? "Doug Robbins - Word MVP" wrote: I am not sure what you mean by EndNote citation fields. If you use Alt+F9 to toggle on the display of field codes in the Word document, what do you see in place of the fields that you want to modify? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "David Newmarch" wrote in message ... In Word 2007 I'm editing a paper which contains EndNote citation fields, and in the course of switching the paper to a different bibliographic style I need to find and replace any space that occurs before a citation. Each citation exists in the document as a field in Word. With field codes toggled on, when I do a simple Find for ^d Word finds each field with no trouble, but when I switch on "Use wildcards" and try the syntax Find: ( )(^d) - and I have also tried ( )([^d]) I get an error message saying that ^d is not supported when the Wildcards check box is selected. Can anyone help me with Find and replace syntax that will work for this task? . |
#16
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Many thanks Graham. It works like a charm.
This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. |
#17
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Many thanks Graham. It works like a charm.
This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. |
#18
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Let me get this right ... you want to move any comma or full stop that comes
immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. |
#19
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Perfect. Does exactly what's needed. One click in EndNote converts the
citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. . |
#20
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Perfect. Does exactly what's needed. One click in EndNote converts the
citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. . |
#21
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Make that "one click on this macro now shifts all the citation OUTside the
punctuation mark." Whoops. "David Newmarch" wrote: Perfect. Does exactly what's needed. One click in EndNote converts the citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. . |
#22
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Make that "one click on this macro now shifts all the citation OUTside the
punctuation mark." Whoops. "David Newmarch" wrote: Perfect. Does exactly what's needed. One click in EndNote converts the citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. . |
#23
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Now you've lost me?
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Make that "one click on this macro now shifts all the citation OUTside the punctuation mark." Whoops. "David Newmarch" wrote: Perfect. Does exactly what's needed. One click in EndNote converts the citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. . |
#24
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
Now you've lost me?
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Make that "one click on this macro now shifts all the citation OUTside the punctuation mark." Whoops. "David Newmarch" wrote: Perfect. Does exactly what's needed. One click in EndNote converts the citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. . |
#25
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
It's ok, he's saying the macro is doing just what he wanted. In US
style, footnote marks (etc.) appear to the right, i.e. outside, of punctuation marks, but author-date references are considered part of the sentence so they go to the left, i.e. inside, of punctuation marks. On May 20, 1:01*am, "Graham Mayor" wrote: Now you've lost me? "David Newmarch" wrote in message ... Make that "one click on this macro now shifts all the citation OUTside the punctuation mark." Whoops. "David Newmarch" wrote: Perfect. Does exactly what's needed. One click in EndNote converts the citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields * * If InStr(1, oField.Code, "ADDIN EN.CITE") Then * * * * oField.Select * * * * Selection.Collapse wdCollapseStart * * * * Set oRng = Selection.Range * * * * oRng.MoveStart wdCharacter, -1 * * * * If oRng.Text = " " Then * * * * * *oRng.Text = "" * * * * End If * * * * oField.Select * * * * Selection.Collapse wdCollapseEnd * * * * Set oEnd = Selection.Range * * * * oEnd.End = oEnd.Start + 1 * * * * If oEnd.Text = "," Or oEnd.Text = "." Then * * * * * * oRng.InsertAfter oEnd.Text * * * * * * oEnd.Delete * * * * End If * * End If Next oField -- Graham Mayor - *Word MVP My web sitewww.gmayor.com Word MVP web sitehttp://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. |
#26
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
It's ok, he's saying the macro is doing just what he wanted. In US
style, footnote marks (etc.) appear to the right, i.e. outside, of punctuation marks, but author-date references are considered part of the sentence so they go to the left, i.e. inside, of punctuation marks. On May 20, 1:01*am, "Graham Mayor" wrote: Now you've lost me? "David Newmarch" wrote in message ... Make that "one click on this macro now shifts all the citation OUTside the punctuation mark." Whoops. "David Newmarch" wrote: Perfect. Does exactly what's needed. One click in EndNote converts the citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields * * If InStr(1, oField.Code, "ADDIN EN.CITE") Then * * * * oField.Select * * * * Selection.Collapse wdCollapseStart * * * * Set oRng = Selection.Range * * * * oRng.MoveStart wdCharacter, -1 * * * * If oRng.Text = " " Then * * * * * *oRng.Text = "" * * * * End If * * * * oField.Select * * * * Selection.Collapse wdCollapseEnd * * * * Set oEnd = Selection.Range * * * * oEnd.End = oEnd.Start + 1 * * * * If oEnd.Text = "," Or oEnd.Text = "." Then * * * * * * oRng.InsertAfter oEnd.Text * * * * * * oEnd.Delete * * * * End If * * End If Next oField -- Graham Mayor - *Word MVP My web sitewww.gmayor.com Word MVP web sitehttp://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. |
#27
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
OK thanks for the explanation. I was beginning to think I had boobed -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Peter T. Daniels" wrote in message ... It's ok, he's saying the macro is doing just what he wanted. In US style, footnote marks (etc.) appear to the right, i.e. outside, of punctuation marks, but author-date references are considered part of the sentence so they go to the left, i.e. inside, of punctuation marks. On May 20, 1:01 am, "Graham Mayor" wrote: Now you've lost me? "David Newmarch" wrote in message ... Make that "one click on this macro now shifts all the citation OUTside the punctuation mark." Whoops. "David Newmarch" wrote: Perfect. Does exactly what's needed. One click in EndNote converts the citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web sitewww.gmayor.com Word MVP web sitehttp://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. |
#28
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard to Find and Replace with fields?
OK thanks for the explanation. I was beginning to think I had boobed
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Peter T. Daniels" wrote in message ... It's ok, he's saying the macro is doing just what he wanted. In US style, footnote marks (etc.) appear to the right, i.e. outside, of punctuation marks, but author-date references are considered part of the sentence so they go to the left, i.e. inside, of punctuation marks. On May 20, 1:01 am, "Graham Mayor" wrote: Now you've lost me? "David Newmarch" wrote in message ... Make that "one click on this macro now shifts all the citation OUTside the punctuation mark." Whoops. "David Newmarch" wrote: Perfect. Does exactly what's needed. One click in EndNote converts the citation style, and one click on this macro now shifts all the citations inside the punctuation mark. Huge time saver. Thank you very much indeed. "Graham Mayor" wrote: Let me get this right ... you want to move any comma or full stop that comes immediately after the closing bracket of the field to immediately before the opening bracket of the field. Is that correct? In that case you can create another range at the end of the field to encompass the following character, essentially repeating the process to remove the space, and add the content of that range (if a comma or a full stop) after the previous range, before deleting the the second range. Dim oField As Field Dim oRng As Range, oEnd As Range For Each oField In ActiveDocument.Fields If InStr(1, oField.Code, "ADDIN EN.CITE") Then oField.Select Selection.Collapse wdCollapseStart Set oRng = Selection.Range oRng.MoveStart wdCharacter, -1 If oRng.Text = " " Then oRng.Text = "" End If oField.Select Selection.Collapse wdCollapseEnd Set oEnd = Selection.Range oEnd.End = oEnd.Start + 1 If oEnd.Text = "," Or oEnd.Text = "." Then oRng.InsertAfter oEnd.Text oEnd.Delete End If End If Next oField -- Graham Mayor - Word MVP My web sitewww.gmayor.com Word MVP web sitehttp://word.mvps.org "David Newmarch" wrote in message ... Many thanks Graham. It works like a charm. This is the second macro you've provided for me in the last couple of weeks, and it has been an excellent learning curve studying how the VBA pans out. I'm very grateful to you for that. Would I be going too far out out of line to ask if you could extend this piece of code to perform one further operation? Once the spaces to the left of a citation's insertion point have been removed I then want to search for any commas or full stops (only commas or full stops) that come immediately to the right of the insertion point (that would be to the right of the field's closing curly bracket), and move them to a new position immediately to the left of the citation. Possibly this should be a separate operation but I think it would be safe enough to do it all in one shot with a single macro. What these two operations will in effect accomplish is to tidy up the puctuation for conversion of an in-text author-date citation style like APA, where the citation is entered inside a comma or full stop, to a citation style using superscript numbered citations that must follow a comma or full-stop (in this case a superscript version of the Vancouver style that is common in medical publications). A macro that does it all in one click would be a very handy little tool. The author of the paper I'm editing originally wrote it for an APA-style journal, then decided to switch and send it to a medical-style journal. EndNote will change the form of the citations for you, but it doesn't have a way to shift their location. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find and replace using wildcard | New Users | |||
find and replace using wildcard characters | New Users | |||
Find & Replace Wildcard Expression for Ordinal Numbers | Microsoft Word Help | |||
How do I Find and replace date fields? | Microsoft Word Help | |||
Trying to replace words with fields using Find/Replace | Microsoft Word Help |