I read your example wrong. "/*/" is all you really need.
> I read your example wrong. "/*/" is all you really need.
Hello. Yesterday, Greg provided me the following macro
Sub EliminarCSSComentarios()
Dim oRng As Range
Set oRng = ActiveDocument.Content
With oRng.Find
.ClearFormatting
.Text = "/* */"
'.Text = "/*/"
.Forward = True
.Wrap = wdFindStop 'para cuando se llega al final del documento
.MatchWildcards = True
'oRng.Select
'MsgBox "se encontró"
Do While .Execute
oRng.Select
MsgBox "encontro"
oRng.Delete
Loop
End With
Which supposedly should find every text between /* and */ , and delete
it. So, I tryied it starting whith this text
/* All this text should /be removed */
/* All this text /should be removed */
/* All this text should be /removed */
but the result was:
be removed ** All this text
removed */
...so I tried changing ".text" to .Text = "/* */", but it didn't work
either. The result was
slightly different, but not what I expected:
be removed *should be removed *removed */
It seems to me that the code is finding text between / and /, and not
between /* and */
Anyone could give me some hints about that ?
tnx - jm
Greg Maxey - 24 Feb 2006 01:55 GMT
Try this as the find string:
/\*?{1,}\*/

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
>> I read your example wrong. "/*/" is all you really need.
>
[quoted text clipped - 44 lines]
>
> tnx - jm