#1
|
|||
|
|||
Find first character of a line
Hi,
Without a macro, is it possible to find if a given character stands at the beggining of a line and which line ? Thanks |
#2
|
||||
|
||||
As far as I know, that is not possible.
I'm not even sure it can be done with a macro. If you had asked about the first character of a paragraph, that would be simple in VBA, though.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#3
|
||||
|
||||
What is the purpose of such a requirement?
How would you use this information and how should it be presented to you if you didn't want it provided by a macro?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
|||
|
|||
First character
Thanks for your responses.
The purpose of my question is to spot some characters wich stands at the begining of lines. This lines come from a justified Word document and I want to correct them if ? : . " etc appears in first position. I'll use any given macro but I did'nt find one. |
#5
|
||||
|
||||
If you are saying that punctuation marks may be preceded with a space, which would be required if they appear at the beginning of a text line, you could of course search for <space>? etc.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#6
|
||||
|
||||
In a properly punctuated document, that won't happen. Such formatting indicates the presence of a space before the punctuation mark and, quite possibly, is associated with the lack of a space after it. This can all be cleaned up through Find/Replace; it really has nothing to do with line starts/ends.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
First character
Hello,
This is not due to punctuation, but to justification. The text is in French and here is an example of the justification result. ...hommage, nous n'en voulons pas et vous portons comme partie responsable de ce qui nous arrive ! C'est plus tôt qu'il fallait agir ... The explamation point ! begins a new line the previous one begins with hommage and ends with arrive instead of arrive !. Many thanks. |
#8
|
||||
|
||||
I understand that a space is sometimes (always?) required with punctuation in French, but the space should then be a nonbreaking space so that punctuation marks can't end up at the beginning of a text line by themselves.
Was the text perhaps originally created in a program that can't manage nonbreaking spaces (such as a plain text editor)? What you can do is replace a space character and a following punctuation mark with a nonbreaking space and the same punctuation mark, for example: ^s?
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#9
|
|||
|
|||
First character
Thank you Stefan,
You're probably true. The rules for space in french typography are a little bit complicated, with many exceptions. My exemple comes from an old text in fact a quote. |
#10
|
||||
|
||||
Quote:
My experience is based on an observation of what happens when I apply French language formatting to text and then insert quotation marks. AutoCorrect will change the marks to guillemets and add nonbreaking spaces.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#11
|
||||
|
||||
Your document could be cleaned up with a sequence of wildcard Find/Replace operations:
Find = ([ ^s]{1,})([.,»\!\?\:\;\)\}\]\>]{1,}) Replace = \2\1 Find = ([«\(\{\[\<]{1,})([ ^s]{1,}) Replace = \2\1 Find = ([ ^s]){1,} Replace = \1 Find = [ ^s]([^13^l]) Replace = \1 If you're using a system with non-English regional language settings, you will need to change the {,} expressions to {;}.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
Thanks to Stefan and Paul. I'll try Paul's suggestion, if I'm able to understand the exact syntax of Find and Replace commands.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to bold a whole line in Word based on a word or character on the line | Yancx | Word | 6 | 03-21-2018 04:48 PM |
Delete Character on Single Line Only | Tye30 | Word VBA | 8 | 04-20-2017 08:40 PM |
Every page indents first line one character | glennhardy | Word | 6 | 02-05-2016 04:05 PM |
Use character instead of line for table border | dlowrey | Word Tables | 6 | 03-09-2015 11:29 AM |
Find max number of same subsequent character | NobodysPerfect | Word VBA | 9 | 05-25-2014 01:10 AM |