Sub Macro2()
'
' Macro2 Macro
'
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Do
With Selection.Find
.Text = "\(*\)"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Cut
With Selection
With .FootnoteOptions
.Location = wdBottomOfPage
.NumberingRule = wdRestartContinuous
.StartingNumber = 1
.NumberStyle = wdNoteNumberStyleArabic
End With
.Footnotes.Add Range:=Selection.Range, Reference:=""
End With
Selection.PasteAndFormat (wdPasteDefault)
Selection.HomeKey Unit:=wdStory
Loop
End Sub
Sub ParenthesisToFootnote()
Application.ScreenUpdating = False
again:
Selection.Find.ClearFormatting
If Selection.Find.Execute(findText:="\(*\)", MatchWildcards:=True, Wrap:=wdFindStop) = True Then
strt = 2: lent = Len(Selection.Text)
re:
For i = strt To lent
If Mid(Selection.Text, i, 1) = chr(40) Then
Selection.Extend Character:=chr(41)
strt = i + 1: lent = Len(Selection.Text)
GoTo re
End If
Next
mRange = Right(Selection.Text, (Len(Selection.Text) - 1))
Selection.Delete
ActiveDocument.Footnotes.Add Range:=Selection.Range, Reference:="", Text:=Left(mRange, (Len(mRange) - 1)) & "."
If Selection.Previous.Text = " " Then Selection.Delete Unit:=wdCharacter, Count:=-1
GoTo again
End If
Application.ScreenUpdating = True
End Sub
נכתב ע"י קרש;492865:מאקרו להוריד כל הסוגריים שבקובץ (כולל סוגריים בתוך סוגריים) להערות שוליים.
- המאקרו יעבור על כל הסוגריים שבקובץ, מן הסמן והלאה.
- גם ימחוק סוגריים החיצוניים, ויוסיף נקודה בסוף ההערה.
- גם ימחוק הריווח המיותר בפנים הטקסט שהיתה לפני הסוגר הראשון.
יש לציין שכל המאפיינים של טקסט הסוגריים (הדגשות וכדו') נאבדים.
קוד:Sub ParenthesisToFootnote() Application.ScreenUpdating = False again: Selection.Find.ClearFormatting If Selection.Find.Execute(findText:="\(*\)", MatchWildcards:=True, Wrap:=wdFindStop) = True Then strt = 2: lent = Len(Selection.Text) re: For i = strt To lent If Mid(Selection.Text, i, 1) = chr(40) Then Selection.Extend Character:=chr(41) strt = i + 1: lent = Len(Selection.Text) GoTo re End If Next mRange = Right(Selection.Text, (Len(Selection.Text) - 1)) Selection.Delete ActiveDocument.Footnotes.Add Range:=Selection.Range, Reference:="", Text:=Left(mRange, (Len(mRange) - 1)) & "." If Selection.Previous.Text = " " Then Selection.Delete Unit:=wdCharacter, Count:=-1 GoTo again End If Application.ScreenUpdating = True End Sub
בהצלחה!
מישהו יכול להסביר איך משתמשים בקוד הזה?קוד:Sub ParenthesisToFootnote() Application.ScreenUpdating = False again: Selection.Find.ClearFormatting If Selection.Find.Execute(findText:="\(*\)", MatchWildcards:=True, Wrap:=wdFindStop) = True Then strt = 2: lent = Len(Selection.Text) re: For i = strt To lent If Mid(Selection.Text, i, 1) = chr(40) Then Selection.Extend Character:=chr(41) strt = i + 1: lent = Len(Selection.Text) GoTo re End If Next mRange = Right(Selection.Text, (Len(Selection.Text) - 1)) Selection.Delete ActiveDocument.Footnotes.Add Range:=Selection.Range, Reference:="", Text:=Left(mRange, (Len(mRange) - 1)) & "." If Selection.Previous.Text = " " Then Selection.Delete Unit:=wdCharacter, Count:=-1 GoTo again End If Application.ScreenUpdating = True End Sub
בהצלחה!
וואה! עובד מעולה
- המאקרו יעבור על כל הסוגריים שבקובץ, מן הסמן והלאה.
- גם ימחוק סוגריים החיצוניים, ויוסיף נקודה בסוף ההערה.
- גם ימחוק הריווח המיותר בפנים הטקסט שהיתה לפני הסוגר הראשון.
rhon.co.il
מעכשיו, תהיו הראשונים לקבל את כל העדכונים, החדשות, ההפתעות בלעדיות, והתכנים הכי חמים שלנו בפרוג!
חלה שגיאה בשליחה. נסו שוב!
לוח לימודים
מסלולי לימוד שאפשר להצטרף
אליהם ממש עכשיו:
תהילים פרק כה
אלְדָוִד אֵלֶיךָ יי נַפְשִׁי אֶשָּׂא:באֱלֹהַי בְּךָ בָטַחְתִּי אַל אֵבוֹשָׁה אַל יַעַלְצוּ אֹיְבַי לִי:גגַּם כָּל קוֶֹיךָ לֹא יֵבֹשׁוּ יֵבֹשׁוּ הַבּוֹגְדִים רֵיקָם:דדְּרָכֶיךָ יי הוֹדִיעֵנִי אֹרְחוֹתֶיךָ לַמְּדֵנִי:ההַדְרִיכֵנִי בַאֲמִתֶּךָ וְלַמְּדֵנִי כִּי אַתָּה אֱלֹהֵי יִשְׁעִי אוֹתְךָ קִוִּיתִי כָּל הַיּוֹם:וזְכֹר רַחֲמֶיךָ יי וַחֲסָדֶיךָ כִּי מֵעוֹלָם הֵמָּה:זחַטֹּאות נְעוּרַי וּפְשָׁעַי אַל תִּזְכֹּר כְּחַסְדְּךָ זְכָר לִי אַתָּה לְמַעַן טוּבְךָ יי:חטוֹב וְיָשָׁר יי עַל כֵּן יוֹרֶה חַטָּאִים בַּדָּרֶךְ:טיַדְרֵךְ עֲנָוִים בַּמִּשְׁפָּט וִילַמֵּד עֲנָוִים דַּרְכּוֹ:יכָּל אָרְחוֹת יי חֶסֶד וֶאֱמֶת לְנֹצְרֵי בְרִיתוֹ וְעֵדֹתָיו:יאלְמַעַן שִׁמְךָ יי וְסָלַחְתָּ לַעֲוֹנִי כִּי רַב הוּא:יבמִי זֶה הָאִישׁ יְרֵא יי יוֹרֶנּוּ בְּדֶרֶךְ יִבְחָר:יגנַפְשׁוֹ בְּטוֹב תָּלִין וְזַרְעוֹ יִירַשׁ אָרֶץ:ידסוֹד יי לִירֵאָיו וּבְרִיתוֹ לְהוֹדִיעָם:טועֵינַי תָּמִיד אֶל יי כִּי הוּא יוֹצִיא מֵרֶשֶׁת רַגְלָי:טזפְּנֵה אֵלַי וְחָנֵּנִי כִּי יָחִיד וְעָנִי אָנִי:יזצָרוֹת לְבָבִי הִרְחִיבוּ מִמְּצוּקוֹתַי הוֹצִיאֵנִי:יחרְאֵה עָנְיִי וַעֲמָלִי וְשָׂא לְכָל חַטֹּאותָי:יטרְאֵה אוֹיְבַי כִּי רָבּוּ וְשִׂנְאַת חָמָס שְׂנֵאוּנִי:כשָׁמְרָה נַפְשִׁי וְהַצִּילֵנִי אַל אֵבוֹשׁ כִּי חָסִיתִי בָךְ:כאתֹּם וָיֹשֶׁר יִצְּרוּנִי כִּי קִוִּיתִיךָ:כבפְּדֵה אֱלֹהִים אֶת יִשְׂרָאֵל מִכֹּל צָרוֹתָיו:
הנושאים החמים