Change first space in each paragraph to a tab

MS WORD

    Next

  • 1. data form auto open in Word.
    How do I get a data form to automatically open when opening word document?
  • 2. How to find any of a set of characters in a string
    Hello, How do I determine if one or more of a set of characters occurs in a given string? For example, I need to determine if d, D, or r occurs in the current .range object. I was hoping for something like: InStr(1, .range, "[aDr]") but that doesn't work. Any help would be appreciated!
  • 3. database error
    This is my macro code...: Sub ToDB() Dim csConn, rsRecSet As Recordset, strSQL As String, strUser As String strSQL = "INSERT INTO jbDBTable (CO, CREATED) VALUES ('xyz', date())" Set csConn = CreateObject("adodb.connection") csConn.ConnectionString = "data source=C:\Data\0\jbDB.mdb; Provider=Microsoft.Jet.OLEDB.4.0;" Set rsRecSet = CreateObject("adodb.recordset") rsRecSet.Open strSQL, csConn csConn.Close End Sub ...and this is my error with bugs: Run-time error: '3709': The connection cannot be used to perform this operation. It is either closed or invalid in this context. Any answers? -- Bryan
  • 4. Automatic text
    I "inherited" a template for a contract our Salesmen use here. The way it works is, they type a number and then hit F3 and text appears. There are around 50 different numbers and each one represents a different item on the contract. For example, 1 is Carpet Cleaning, 2 is Carpet Shampooing, 3 is Window Washing, etc. I would like to edit the text that is appearing but I am not sure where to find it. I do not see a macro in the template. Any ideas where this text might reside? Any help would be appreciated. Regards, Vida Shaver XXXX@XXXXX.COM
  • 5. problem with colour
    I am a bit of a novice so the answer may be simple! When I print a document, whenever I use the colour red it comes out yellow. I have checked the ink status which is okay. Hope you can help!!!

Change first space in each paragraph to a tab

Postby Brian Holfield » Wed, 16 Nov 2005 03:51:02 GMT

Does anyone have a simple macro that will change the first space in
each paragraph to a tab? Greatly appreciate some help with this.


Re: Change first space in each paragraph to a tab

Postby Jezebel » Wed, 16 Nov 2005 04:43:06 GMT

Find and Replace will do this. Search for ^p[space], replace with ^p^t.












Re: Change first space in each paragraph to a tab

Postby Brian Holfield » Wed, 16 Nov 2005 13:27:11 GMT

Thanks, Jezebel, but this will only work if the first character of each
paragraph is a space. I have no way of knowing how many characters
occur before the first space in each paragraph.








Re: Change first space in each paragraph to a tab

Postby Jezebel » Wed, 16 Nov 2005 15:19:51 GMT

Sorry, I assumed you meant leading space. For the cases where there are 
intervening characters, check the 'Use wildcards' checkbox and use

Search for: (^013[! ]{1,})[space]
Replace with: \1^009














Re: Change first space in each paragraph to a tab

Postby Brian Holfield » Wed, 16 Nov 2005 16:32:48 GMT

Thanks, Jezebel, but I'm still having trouble, probably because I
have little undertanding of the symbols used. With 'Use wildcards'
checked and ignoring the asterisks, I've tried these combinations for
find, but none of them works:
*(^013[! ]{1,})[space]*
*(^013[! ]{1,})[ ]*
*(^013[! ]{1,}) *


Re: Change first space in each paragraph to a tab

Postby Jezebel » Wed, 16 Nov 2005 20:12:23 GMT

[space] just means a single space, no brackets, so your third option looks 
right. What it all means:

^013 is a paragraph mark
[! ] means "not space"
{1,} means one or more of the preceding matching -- in this case [! ]{1,} 
means one or more non-spaces
Tbe brackets are for grouping, to match up with the \1 in the replace 
string.

So all combined, what you're searching for is "paragraph mark followed by 
one or more non-spaces followed by a space". You're replacing with "whatever 
was matched by the contents of the brackets, plus a tab"

I tested it -- it does work.












Re: Change first space in each paragraph to a tab

Postby Brian Holfield » Thu, 17 Nov 2005 03:06:40 GMT

Thanks again , Jezebel. Slowly getting there. Seems like I have a
problem within a problem. I believe the reason nothing was happening
was because I was using the Czech version of Word. Let's leave that
aside for a moment.

When  I use the American version of Word, the Find works, but not as I
want it to. The wild card expression selects a paragraph mark and the
text in the next line up to and including the first space. I'm trying
to find the first space in each line. Example:
abc def ghi
a bcd fgh i
ab cdfg hi
line 1, needs selection of the space between c and d
line 2, needs selection of the space between a and b
line 3, needs selection of the space between b and c

I tried reading the help on wild cards, but it was beyond me. Really
needs an expert.


Re: Change first space in each paragraph to a tab

Postby Greg » Thu, 17 Nov 2005 03:25:00 GMT

The method Jezebel provide will work for all paragraphs except
paragraph 1.  That one you will need to do manually.  If it isn't
working, then the units that you are called paragraphs (i.e., lines)
are not in fact individual paragraphs.


Re: Change first space in each paragraph to a tab

Postby Jezebel » Thu, 17 Nov 2005 05:28:34 GMT

Yes, it finds the paragraph mark. That's OK: it's just another character, 
and it gets replaced.










Re: Change first space in each paragraph to a tab

Postby Jean-Guy Marcil » Thu, 17 Nov 2005 10:41:53 GMT

Brian Holfield was telling us:
Brian Holfield nous racontait que :


Replace the "," by a ";"
The semi-colon is probably the list delimiter in Czech, as it is in many 
European version of Windows.

-- 
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
 XXXX@XXXXX.COM 
Word MVP site:  http://www.**--****.com/  



Re: Change first space in each paragraph to a tab

Postby Brian Holfield » Thu, 17 Nov 2005 16:21:11 GMT

Oops! Yes, It works. I shot myself in the foot by not understanding the
code and going step by step. When I saw so much selected by the find my
reaction was: Whoa, I don't want to replace all that with a tab. But,
now I see that the replace code takes care of that nicely. Thanks for
being so patient with me, Jezebel, and thanks for solving a problem
that was holding me up.








Re: Change first space in each paragraph to a tab

Postby Brian Holfield » Thu, 17 Nov 2005 16:24:28 GMT

Yes, it works nicely, Greg. My paragraphs were OK, it was my mental
attitude that tripped me up - see reply to Jezebel


Re: Change first space in each paragraph to a tab

Postby Brian Holfield » Thu, 17 Nov 2005 16:28:56 GMT

Thanks for the suggestion, Jean-Guy. That's probably the right
direction, but it needs something in addition to changing , to ;.


Similar Threads:

1.Programmatic change first space in each paragraph to a tab

abc def ghi
a bcd fgh i
ab cdfg hi
line 1, needs a tab instead of the space between c and d
line 2, needs a tab instead of the space between a and b
line 3, needs a tab instead of the space between b and c

Currently this is being done with a search and replace, using
wildcards:
Search for: (^013[! ]{1,})[space]
Replace with: \1^009

Is it possible to achieve the same result using a macro? Since a number
of people have to make this change, it would be easier to have them run
FirstSpaceToTab than to train them to use this tricky Search and
Replace.
Thanks for any help.

2.Tab changes in my second paragraph are changing tabs in my first

When I change a tab in my second paragraph it makes the same change in my 
first paragraph.  Why and how do I change this?  I've taken off almost all 
the autoformatting.  This is exceedingly annoying and I can't imagine why 
Word would do this.

3.Tab changes in my second paragraph are changing tabs in my fir

Carol, I don't think so.  I searched around and took off all the auto update 
things that I could see.  I liked Word better before it tried so hard to read 
my mind.  It's not very good at it.

"Carol" wrote:

> Are you using styles?  Perhaps you have updating styles.
> -- 
> Carol A. Bratt, MCP
> 
> 
> 
> "PrairiePaintbrush" wrote:
> 
> > When I change a tab in my second paragraph it makes the same change in my 
> > first paragraph.  Why and how do I change this?  I've taken off almost all 
> > the autoformatting.  This is exceedingly annoying and I can't imagine why 
> > Word would do this.

4.Changing default tabs in one paragraph changes all tabs

In a large Word 2003 document, I'm trying to change the default tabs for one 
paragraph, or a selection of paragraphs, by selecting them, then going to 
Format: Tabs: Default Tab stops and changing them from .25" to .5".  The 
result is that the tabs in the entire document change from .25" to .5".  I 
haven't noticed this behaviour before.  Is there some other formatting that 
could interfere with the tab setting change?  Is there any other way to 
change the tabs besides manually entering tabs for paragraphs in which I 
don't want to use the default tabs?

5.Using hanging indent on paragraph where first line contains tab

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

Is there any way to put a hanging indent of more than one tab stop on a paragraph where the first line is indented using a tab? I thought I'd figured out how to do it in Word 2004, but maybe not.

What I'd like to have is something like the following, hopefully this shows up correctly when the HTML formats this message:

Heading
   Vocabulary: definition definition definition definition definition definition definition definition blah blah

Where I'd like subsequent lines of the definition to begin aligned with the first word of the definition that follows the vocabulary word.

You may wonder why I don't just use an indent for the start of the vocab word paragraph. The reason is I'm using some paragraph border formatting which indents itself when the paragraph is indented, and I want all the paragraph borders in the same spot on the left. Any ideas?

6. No Space Before first paragraph Word 2007

7. Printing Paragraph, Tab and Space Marks

8. How do I change the default paragraph indent when first opening Wo



Return to MS WORD

 

Who is online

Users browsing this forum: No registered users and 19 guest