Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 03-07-2013, 03:09 PM
Jamal NUMAN Jamal NUMAN is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 64bit
Expert
How to combine many paragraphs in one paragraph?
 
Join Date: Nov 2010
Posts: 525
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by macropod View Post
The only way you can do that with Find/Replace is to input both the Find and Replace strings you want. A wildcard Find/Replace cannot change the capitalisation of a random string.
Many thanks Paul for the answer,

I couldn’t know how to eliminate spaces between words such that



“National spatial plan of zone one”

Will look like:

“Nationalspatialplanofzoneone”


What should I include in the code below to eliminate spaces between words?

.Text = "[,.;:‘’'“”""/\!\#\*\†\?\\]


Best

Jamal
__________________
Jamal NUMAN, Jamal432@gmail.com, P.O.BoX: 731, Ramallah, West Bank.
Reply With Quote
  #17  
Old 03-07-2013, 03:30 PM
macropod's Avatar
macropod macropod is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Unless you want to have to manually select every occurrence of 'National spatial plan of zone one', you should use an ordinary Find/Replace, with:
Find = National spatial plan of zone one
Replace = NationalSpatialPlanOfZoneOne
or:
Find = National spatial plan of zone one
Replace = Nationalspatialplanofzoneone
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #18  
Old 03-07-2013, 03:53 PM
Jamal NUMAN Jamal NUMAN is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 64bit
Expert
How to combine many paragraphs in one paragraph?
 
Join Date: Nov 2010
Posts: 525
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by macropod View Post
Unless you want to have to manually select every occurrence of 'National spatial plan of zone one', you should use an ordinary Find/Replace, with:
Find = National spatial plan of zone one
Replace = NationalSpatialPlanOfZoneOne
or:
Find = National spatial plan of zone one
Replace = Nationalspatialplanofzoneone
Thanks Paul,

Is there any code to this?

It is very frequent that I need to eliminate spaces between selected words in different cases!

Is there such code that eliminates spaces between selected words?
__________________
Jamal NUMAN, Jamal432@gmail.com, P.O.BoX: 731, Ramallah, West Bank.
Reply With Quote
  #19  
Old 03-07-2013, 04:05 PM
macropod's Avatar
macropod macropod is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It ia not proctical to use a macro - it would have no advantage over Ctrl-H to access the Find/Replace dialogue. As I said before, you would need to input the exact Find/replace strings. Sure, you can tell Word to find spaces and delete them, but it will delete all spaces in the selection/document - hardly the kind of thing I would want to trust to a macro.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #20  
Old 03-07-2013, 04:24 PM
Jamal NUMAN Jamal NUMAN is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 64bit
Expert
How to combine many paragraphs in one paragraph?
 
Join Date: Nov 2010
Posts: 525
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by macropod View Post
It ia not proctical to use a macro - it would have no advantage over Ctrl-H to access the Find/Replace dialogue. As I said before, you would need to input the exact Find/replace strings. Sure, you can tell Word to find spaces and delete them, but it will delete all spaces in the selection/document - hardly the kind of thing I would want to trust to a macro.
Then in my case, each time I need to capitalize (particular words) and then to remove spaces between them then I need to apply the built in commands (attached) and no such macro can do this kind of work

Best

Jamal
Attached Images
File Type: jpg Clip_376.jpg (51.7 KB, 10 views)
File Type: jpg Clip_377.jpg (46.9 KB, 10 views)
File Type: jpg Clip_378.jpg (55.1 KB, 10 views)
__________________
Jamal NUMAN, Jamal432@gmail.com, P.O.BoX: 731, Ramallah, West Bank.
Reply With Quote
  #21  
Old 03-07-2013, 04:34 PM
macropod's Avatar
macropod macropod is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It's not really a question of whether you can do it with a macro. The real issue is that you can't do it without knowing what the starting text is. While it is possible to do the conversions with a macro, using a selection as a starting point (thus providing the starting text), why are you not entering the text as you want it to appear? To me, it seems rather silly for someone to type 'National spatial plan of zone one' or 'national spatial plan of zone one' when what is really wanted is 'NationalSpatialPlanOfZoneOne'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #22  
Old 03-08-2013, 02:21 AM
Jamal NUMAN Jamal NUMAN is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 64bit
Expert
How to combine many paragraphs in one paragraph?
 
Join Date: Nov 2010
Posts: 525
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by macropod View Post
It's not really a question of whether you can do it with a macro. The real issue is that you can't do it without knowing what the starting text is. While it is possible to do the conversions with a macro, using a selection as a starting point (thus providing the starting text), why are you not entering the text as you want it to appear? To me, it seems rather silly for someone to type 'National spatial plan of zone one' or 'national spatial plan of zone one' when what is really wanted is 'NationalSpatialPlanOfZoneOne'.
Thanks Paul,

Let me just give an example,

It is very frequent that I receive lisp files for the AutoCAD. Then the issue here is to better manage these lisp files.

1. I ensure that the spelling that describes what each lisp file does is correct. In this case, I’m obliged to type them word by word with space!

2. As names with spaces are rejected in the AutoCAD lisp files (code), then I’m forced to eliminate them. To better distinguish these words, I aimed at letting the first word to be capital

This is the kind of workflow I’m encountered in!

the words are:

Turn on thaw unlock visible annotation then
Turn On Thaw Unlock Visible Annotation then
TurnOnThawUnlockVisibleAnnotation


3. And as I got so many lisp files then it is difficult to manage such very frequent kind of work manually


4. What is wrong with the Word just to eliminate spaces between words by a code (for particular selected words)?

Screenshots are attached

Best

Jamal
Attached Images
File Type: jpg Clip_380.jpg (77.0 KB, 9 views)
File Type: jpg Clip_379.jpg (101.5 KB, 9 views)
__________________
Jamal NUMAN, Jamal432@gmail.com, P.O.BoX: 731, Ramallah, West Bank.
Reply With Quote
  #23  
Old 03-08-2013, 02:45 AM
macropod's Avatar
macropod macropod is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jamal,

The 'normal' approach in such a situation is to replace the spaces with underscores. That way, it remains readable but also works with software that can't handle spaces.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #24  
Old 03-08-2013, 03:46 AM
Jamal NUMAN Jamal NUMAN is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 64bit
Expert
How to combine many paragraphs in one paragraph?
 
Join Date: Nov 2010
Posts: 525
Jamal NUMAN is on a distinguished road
Question

Quote:
Originally Posted by macropod View Post
Hi Jamal,

The 'normal' approach in such a situation is to replace the spaces with underscores. That way, it remains readable but also works with software that can't handle spaces.
Thanks Paul,


And then again we need such code that can replace the spaces with underscores!
__________________
Jamal NUMAN, Jamal432@gmail.com, P.O.BoX: 731, Ramallah, West Bank.
Reply With Quote
  #25  
Old 03-08-2013, 03:49 AM
macropod's Avatar
macropod macropod is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub SpaceToUnderscore()
Application.ScreenUpdating = False
Dim StrFnd As String, StrRep As String
With Selection.Range
  StrFnd = Trim(.Text)
  .Case = wdTitleWord
  StrRep = Replace(Trim(.Text), " ", "_")
End With
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = StrFnd
    .Replacement.Text = StrRep
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
  End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #26  
Old 03-08-2013, 04:31 AM
Jamal NUMAN Jamal NUMAN is offline How to combine many paragraphs in one paragraph? Windows 7 64bit How to combine many paragraphs in one paragraph? Office 2010 64bit
Expert
How to combine many paragraphs in one paragraph?
 
Join Date: Nov 2010
Posts: 525
Jamal NUMAN is on a distinguished road
Thumbs up

Quote:
Originally Posted by macropod View Post
Try:
Code:
Sub SpaceToUnderscore()
Application.ScreenUpdating = False
Dim StrFnd As String, StrRep As String
With Selection.Range
  StrFnd = Trim(.Text)
  .Case = wdTitleWord
  StrRep = Replace(Trim(.Text), " ", "_")
End With
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = StrFnd
    .Replacement.Text = StrRep
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
  End With
End With
Application.ScreenUpdating = True
End Sub
Perfect. Very very much appreciated.

I couldn’t imagine this forum without your distinct help and efforts.

Words can't describe how thankful I am

Best

Jamal
Attached Images
File Type: jpg Clip_385.jpg (96.7 KB, 9 views)
File Type: jpg Clip_386.jpg (50.6 KB, 9 views)
__________________
Jamal NUMAN, Jamal432@gmail.com, P.O.BoX: 731, Ramallah, West Bank.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to combine many paragraphs in one paragraph? Track chages combine: Stumped! Ulodesk Word 2 01-03-2011 11:43 AM
How to combine many paragraphs in one paragraph? Combine two forms into one lwisniewski Word VBA 3 12-24-2010 03:45 PM
How to combine many paragraphs in one paragraph? Combine pst files? markg2 Outlook 2 04-26-2010 03:09 PM
How do you combine two contact folders? waikoloavrm Outlook 0 04-12-2010 02:31 PM
Bulletizing one paragraph affects all paragraphs GoodWebby Word 0 10-10-2009 12:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft