בקשת מידע | עזרה בוורד ב'החלפה' - מאקרו VBA
-
במסמך שלי מופיע מיספור סעיפים בצורה כזו: (א)... (ב)... (ג)... אנו מעוניין להוסיף לכל סעיף את המילה 'משנה', כגון משנה א, משנה ב, משנה ג וכו', אשמח אם מישהו יכול להסביר איך עושים זאת.
-
@shishko בהתחלה זה הלך, אבל אח"כ לא, זה מה שמופיע:
@יוסף-בן-חיים
צודק מתנצל סידרתי את זה
תעדכן שבאמת עובדSub החלפת_סוגריים_למשנה() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(" .Replacement.Text = ";" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = ")" .Replacement.Text = "~" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(?~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(??~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ";" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "~" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
בהצלחה
-
במסמך שלי מופיע מיספור סעיפים בצורה כזו: (א)... (ב)... (ג)... אנו מעוניין להוסיף לכל סעיף את המילה 'משנה', כגון משנה א, משנה ב, משנה ג וכו', אשמח אם מישהו יכול להסביר איך עושים זאת.
@יוסף-בן-חיים אתה יכול פשוט להחליף
את (
ב- (משנה
אלא אם יש לך עוד פתיחת סוגריים לדברים אחרים... -
@יוסף-בן-חיים אתה יכול פשוט להחליף
את (
ב- (משנה
אלא אם יש לך עוד פתיחת סוגריים לדברים אחרים...@ginyes זו בדיוק הבעיה
-
@ginyes זו בדיוק הבעיה
@יוסף-בן-חיים ברור שיש לך סוגריים אחרים, השאלה היא האם יש לך עוד אות אות בודדה או שתים בתחילת פיסקה בתוך סוגריים, אם לא אתה יכול לחפש אנטר סוגריים אות כל שהו סוגרי סוגריים
-
@יוסף-בן-חיים ברור שיש לך סוגריים אחרים, השאלה היא האם יש לך עוד אות אות בודדה או שתים בתחילת פיסקה בתוך סוגריים, אם לא אתה יכול לחפש אנטר סוגריים אות כל שהו סוגרי סוגריים
@menajemmendel נכון אבל אני לא צריך חיפוש אלא הוספה, ואת זה לא הצלחתי לעשות בהחלפה, כלומר להוסיף טקסט לכל מקום שיש אות אחת בסוגריים. אשמח לפתרון יעיל.
-
@menajemmendel נכון אבל אני לא צריך חיפוש אלא הוספה, ואת זה לא הצלחתי לעשות בהחלפה, כלומר להוסיף טקסט לכל מקום שיש אות אחת בסוגריים. אשמח לפתרון יעיל.
@יוסף-בן-חיים
תעשה חיפוש כמו שכתבתי לך^13(^$)
ובהחלף תעשה סימון
אחרי זה בחיפוש תעשה סימון, ותחליף אנטר סוגריים לאנטר משנה סוגרייםאחרי זה תעשה אותו דבר על שתי אותיות (כי יש משנה יא יב וכו')
יש דרך ישירה לעשות את זה אבל יותר מסובכת למתחילים
-
@יוסף-בן-חיים
תעשה חיפוש כמו שכתבתי לך^13(^$)
ובהחלף תעשה סימון
אחרי זה בחיפוש תעשה סימון, ותחליף אנטר סוגריים לאנטר משנה סוגרייםאחרי זה תעשה אותו דבר על שתי אותיות (כי יש משנה יא יב וכו')
יש דרך ישירה לעשות את זה אבל יותר מסובכת למתחילים
@menajemmendel כתב בהסבר | עזרה בורד ב'החלפה':
אחרי זה בחיפוש תעשה סימון, ותחליף אנטר סוגריים לאנטר משנה סוגריים
חלק זה לא הבנתי כוונתך
-
@menajemmendel כתב בהסבר | עזרה בורד ב'החלפה':
אחרי זה בחיפוש תעשה סימון, ותחליף אנטר סוגריים לאנטר משנה סוגריים
חלק זה לא הבנתי כוונתך
@יוסף-בן-חיים כתב בהסבר | עזרה בורד ב'החלפה':
חלק זה לא הבנתי כוונתך
בעצם אתה לא צריך עכשיו לחפש אנטר, כי עכשיו הסוגריים הם כבר מסומנים אז תעשה רק: בחיפוש
סוגריים מסומנים
ובהחלף להחליף ל:(משנה ורווח
כזה (בתמונה לא רואים את הרווח, אבל צריך לעשות את זה, אחרת יהיה כתוב משנהא משנהב -
@יוסף-בן-חיים כתב בהסבר | עזרה בורד ב'החלפה':
חלק זה לא הבנתי כוונתך
בעצם אתה לא צריך עכשיו לחפש אנטר, כי עכשיו הסוגריים הם כבר מסומנים אז תעשה רק: בחיפוש
סוגריים מסומנים
ובהחלף להחליף ל:(משנה ורווח
כזה (בתמונה לא רואים את הרווח, אבל צריך לעשות את זה, אחרת יהיה כתוב משנהא משנהב@menajemmendel לא נמצא תוצאות
-
במסמך שלי מופיע מיספור סעיפים בצורה כזו: (א)... (ב)... (ג)... אנו מעוניין להוסיף לכל סעיף את המילה 'משנה', כגון משנה א, משנה ב, משנה ג וכו', אשמח אם מישהו יכול להסביר איך עושים זאת.
@יוסף-בן-חיים תעשה פקודת מאקרו חדשה
ותעתיק מכאןSub הוספת_משנה_בין_הסוגריים()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "("
.Replacement.Text = ";"
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ")"
.Replacement.Text = "~"
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "(;)(?~)"
.Replacement.Text = "\1משנה \2"
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ";"
.Replacement.Text = "("
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "~"
.Replacement.Text = ")"
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Subואז תפעיל על המסמך
לי זה עבד, אם לא עובד לך תעדכן -
אם נטפרי אז צילום מסך 2024-07-30 192045.rar -
אם נטפרי אז צילום מסך 2024-07-30 192045.rar@דוד-משה-1
עדיף שתקח מכאן מתוקן גם במקרה של שני אותיות אחרי הסוגרייםSub הוספת_משנה_בין_הסוגריים() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(" .Replacement.Text = ";" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = ")" .Replacement.Text = "~" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(?~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(??~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ";" .Replacement.Text = "(" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "~" .Replacement.Text = ")" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
בהצלחה תעדכן שעבד
@דוד-משה-1 תודה רבה
-
@menajemmendel לא נמצא תוצאות
@יוסף-בן-חיים כתב בהסבר | עזרה בורד ב'החלפה':
@menajemmendel לא נמצא תוצאות
כנראה לא עשית טוב. האם הבנת את העיקרון של הרעיון שלי?
-
@יוסף-בן-חיים כתב בהסבר | עזרה בורד ב'החלפה':
@menajemmendel לא נמצא תוצאות
כנראה לא עשית טוב. האם הבנת את העיקרון של הרעיון שלי?
@menajemmendel הלכתי לפי ההנחיות שלך, לא הבנתי בדיוק מה העיקרון, אולי תסביר לי מה העניין של סימון.
-
@דוד-משה-1
עדיף שתקח מכאן מתוקן גם במקרה של שני אותיות אחרי הסוגרייםSub הוספת_משנה_בין_הסוגריים() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(" .Replacement.Text = ";" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = ")" .Replacement.Text = "~" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(?~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(??~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ";" .Replacement.Text = "(" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "~" .Replacement.Text = ")" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
בהצלחה תעדכן שעבד
@דוד-משה-1 תודה רבה
@shishko בהתחלה זה הלך, אבל אח"כ לא, זה מה שמופיע:
-
@shishko בהתחלה זה הלך, אבל אח"כ לא, זה מה שמופיע:
@יוסף-בן-חיים
צודק מתנצל סידרתי את זה
תעדכן שבאמת עובדSub החלפת_סוגריים_למשנה() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(" .Replacement.Text = ";" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = ")" .Replacement.Text = "~" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(?~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(??~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ";" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "~" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
בהצלחה
-
@יוסף-בן-חיים
צודק מתנצל סידרתי את זה
תעדכן שבאמת עובדSub החלפת_סוגריים_למשנה() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(" .Replacement.Text = ";" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = ")" .Replacement.Text = "~" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = False End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(?~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "(;)(??~)" .Replacement.Text = "\1משנה \2" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = ";" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll With Selection.Find .Text = "~" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .MatchWholeWord = False End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
בהצלחה
@shishko ברוך ה' עובד, אשמח אם תוכל לערוך כך שלא יהיה בתוך סוגריים [משנה א במקום (משנה א) ]. ישר כח