דילוג לתוכן
  • חוקי הפורום
  • לא נפתר
  • משתמשים
  • חיפוש גוגל בפורום
  • צור קשר
עיצובים
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • ברירת מחדל (ללא עיצוב (ברירת מחדל))
  • ללא עיצוב (ברירת מחדל)
כיווץ
לוגו מותג
  1. דף הבית
  2. תוכנות
  3. יישומי אופיס
  4. וורד
  5. עזרה הדדית - וורד
  6. שיתוף | אינצקלופדיה שיתופית עבור קודים של מאקרו - איך עושים את....

שיתוף | אינצקלופדיה שיתופית עבור קודים של מאקרו - איך עושים את....

מתוזמן נעוץ נעול הועבר עזרה הדדית - וורד
50 פוסטים 6 כותבים 1.7k צפיות 6 עוקבים
  • מהישן לחדש
  • מהחדש לישן
  • הכי הרבה הצבעות
תגובה
  • תגובה כנושא
התחברו כדי לפרסם תגובה
נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
  • 1 121244

    פוסט זה נמחק!

    P מנותק
    P מנותק
    pcinfogmach
    מדריכים
    כתב ב נערך לאחרונה על ידי
    #20
    פוסט זה נמחק!
    תגובה 1 תגובה אחרונה
    0
    • P מנותק
      P מנותק
      pcinfogmach
      מדריכים
      כתב ב נערך לאחרונה על ידי pcinfogmach
      #21

      חיפוש והחלפה במסמכים מרובים לפי תיקיות

      Sub SearchReplaceAllDocumentsInFolder()
          Dim FolderPath As String
          Dim FileName As String
          Dim DocumentPath As String
          Dim doc As Document
          Dim Counter As Long
              
          ' Select the folder containing the documents
          With Application.FileDialog(msoFileDialogFolderPicker)
              .Title = "Select Folder"
              If .Show = -1 Then
                  FolderPath = .SelectedItems(1) & "\"
              Else
                  Exit Sub
              End If
          End With
          
          ' Disable screen updating for faster execution
          Application.ScreenUpdating = False
          
          ' Initialize counters
          Counter = 0
          
          ' Loop through each file in the folder
          FileName = Dir(FolderPath & "*.doc*")
          Do While FileName <> ""
              ' Construct the full path of the document
              DocumentPath = FolderPath & FileName
              
              ' Open the document
              Set doc = Documents.Open(FileName:=DocumentPath)
              
              ' Perform the search and replace
              With doc.Content.Find
                  .ClearFormatting
                  .text = "הזן כאן את הטקסט לחיפוש" ' Replace "SearchText" with your desired search text
                  .Replacement.ClearFormatting
                  .Replacement.text = "הזן כאן את הטקסט להחלפה" ' Replace "ReplaceText" with your desired replacement text
                  .Execute Replace:=wdReplaceAll
                   End With
              
              ' Save and close the document
              doc.Close SaveChanges:=True
              
              ' Increment counter
              Counter = Counter + 1
              
              ' Move to the next file
              FileName = Dir
          Loop
          
          ' Enable screen updating
          Application.ScreenUpdating = True
          
          ' Display results
          MsgBox "Search and Replace completed." & vbCrLf & _
              "Total Documents Processed: " & Counter
      End Sub
      

      עריכה:
      חיפוש והחלפה במסמכים מרובים לפי בחירת קבצים:

      Sub SearchReplaceAllDocuments()
          Dim FileDialog As FileDialog
          Dim FilePaths As Variant
          Dim FileName As Variant
          Dim srchtxt As String, rplctxt As String
          Dim doc As Document, Counter As Long
          Dim wldcrds As VbMsgBoxResult, srchwldcrds As Boolean
          
         wldcrds = MsgBox("האם ברצונך להשתמש עם תווים כלליים בחיפוש זה?", vbYesNoCancel + vbMsgBoxRight + vbMsgBoxRtlReading + vbQuestion, "חיפוש והחלפה במסמכים מרובים")
          If wldcrds = vbYes Then srchwldcrds = True
          If wldcrds = vbNo Then srchwldcrds = False
          If wldcrds = vbCancel Then Exit Sub
            
          srchtxt = InputBox("הזן טקסט או קוד לחיפוש", "חיפוש והחלפה במסמכים מרובים")
          rplctxt = InputBox("הזן טקסט או קוד להחלפה", "חיפוש והחלפה במסמכים מרובים")
          
          ' Open the file picker dialog
          Set FileDialog = Application.FileDialog(msoFileDialogFilePicker)
          With FileDialog
              .Title = "בחר קבצים (חיפוש בקבצים מרובים לפי בחירת קבצים)"
              .AllowMultiSelect = True
              .Filters.Clear
              .Filters.Add "Word Documents", "*.doc*"
              If .Show = -1 Then
      '            FilePaths = .SelectedItems
              
          
          ' Disable screen updating for faster execution
          Application.ScreenUpdating = False
          
          ' Initialize counter
          Counter = 0
          
          ' Loop through each selected file
          For Each FileName In .SelectedItems
              ' Open the document
              Set doc = Documents.Open(FileName:=FileName)
              
              ' Perform the search and replace
              With doc.Content.Find
                  .ClearFormatting
                  .Text = srchtxt
                  .Replacement.ClearFormatting
                  .Replacement.Text = rplctxt
                  .MatchWildcards = srchwldcrds
                  .Execute Replace:=wdReplaceAll
              End With
              
              ' Save and close the document
              doc.Close SaveChanges:=True
              
              ' Increment counter
              Counter = Counter + 1
          Next FileName
          
          ' Enable screen updating
          Application.ScreenUpdating = True
          
          ' Display results
           ' Display results
          MsgBox "פעולת ההחלפה הסתיימה." & vbCrLf & _
              "מספר המסמכים שבוצע בהם החלפה הם: " & Counter, vbMsgBoxRight, vbMsgBoxRtlReading, "הפעולה הסתיימה"
                  
              End If
          End With
      End Sub
      

      עריכה שניה:
      עכשיו מצאתי את זה
      https://wordmvp.com/FAQs/MacrosVBA/BatchFR.htm
      יש שם הרבה רעיונות עבור שיפור הקוד

      תגובה 1 תגובה אחרונה
      1
      • P מנותק
        P מנותק
        pcinfogmach
        מדריכים
        כתב ב נערך לאחרונה על ידי
        #22

        פתיחת מסמכים מרובים

        Sub OpenAllDocumentsInFolder()
            Dim FolderPath As String
            Dim FileName As String
            Dim DocumentPath As String
            
            ' Select the folder containing the documents
            With Application.FileDialog(msoFileDialogFolderPicker)
                .Title = "Select Folder"
                If .Show = -1 Then
                    FolderPath = .SelectedItems(1) & "\"
                Else
                    Exit Sub
                End If
            End With
            
            ' Disable screen updating for faster execution
            Application.ScreenUpdating = False
            
            ' Loop through each file in the folder
            FileName = Dir(FolderPath & "*.doc*")
            Do While FileName <> ""
                ' Construct the full path of the document
                DocumentPath = FolderPath & FileName
                
                ' Open the document
                Documents.Open FileName:=DocumentPath
                
                ' Move to the next file
                FileName = Dir
            Loop
            
            ' Enable screen updating
            Application.ScreenUpdating = True
        End Sub
        
        1 תגובה 1 תגובה אחרונה
        0
        • P pcinfogmach

          פתיחת מסמכים מרובים

          Sub OpenAllDocumentsInFolder()
              Dim FolderPath As String
              Dim FileName As String
              Dim DocumentPath As String
              
              ' Select the folder containing the documents
              With Application.FileDialog(msoFileDialogFolderPicker)
                  .Title = "Select Folder"
                  If .Show = -1 Then
                      FolderPath = .SelectedItems(1) & "\"
                  Else
                      Exit Sub
                  End If
              End With
              
              ' Disable screen updating for faster execution
              Application.ScreenUpdating = False
              
              ' Loop through each file in the folder
              FileName = Dir(FolderPath & "*.doc*")
              Do While FileName <> ""
                  ' Construct the full path of the document
                  DocumentPath = FolderPath & FileName
                  
                  ' Open the document
                  Documents.Open FileName:=DocumentPath
                  
                  ' Move to the next file
                  FileName = Dir
              Loop
              
              ' Enable screen updating
              Application.ScreenUpdating = True
          End Sub
          
          1 מנותק
          1 מנותק
          106
          כתב ב נערך לאחרונה על ידי 106
          #23

          הכנסת טקסט נבחר (כגון מראה מקום) לתוך סוגריים.

          Sub parenthesis()
          With Selection.Range
          .InsertBefore "("
          .InsertAfter ")"
          End With
          End Sub
          
          ד תגובה 1 תגובה אחרונה
          2
          • 1 106

            הכנסת טקסט נבחר (כגון מראה מקום) לתוך סוגריים.

            Sub parenthesis()
            With Selection.Range
            .InsertBefore "("
            .InsertAfter ")"
            End With
            End Sub
            
            ד מנותק
            ד מנותק
            דאנציג
            כתב ב נערך לאחרונה על ידי דאנציג
            #24

            @106
            @dmp הביא פה בעבר הקוד הזה:

            
            '
            ' סוגריים_עגולות Macro
            '
            '
            Selection.Text = "(" & Selection.Text & ")"
            End Sub
            

            וכאן המקום לשאול, כיצד ניתן להרחיב את הסוגריים עד סוף המילה אפילו כאשר עומדים באמצעה.

            מ תגובה 1 תגובה אחרונה
            1
            • ד דאנציג

              @106
              @dmp הביא פה בעבר הקוד הזה:

              
              '
              ' סוגריים_עגולות Macro
              '
              '
              Selection.Text = "(" & Selection.Text & ")"
              End Sub
              

              וכאן המקום לשאול, כיצד ניתן להרחיב את הסוגריים עד סוף המילה אפילו כאשר עומדים באמצעה.

              מ מנותק
              מ מנותק
              מאקרו
              כתב ב נערך לאחרונה על ידי
              #25

              @דאנציג

              
              Selection.MoveEndWhile Cset:=" ", Count:=wdBackward
              Selection.InsertAfter (")")
              Selection.InsertBefore ("(")
              
              
              ד תגובה 1 תגובה אחרונה
              2
              • מ מאקרו

                @דאנציג

                
                Selection.MoveEndWhile Cset:=" ", Count:=wdBackward
                Selection.InsertAfter (")")
                Selection.InsertBefore ("(")
                
                
                ד מנותק
                ד מנותק
                דאנציג
                כתב ב נערך לאחרונה על ידי
                #26

                @מאקרו
                לא עובד לי.

                יש לציין לתוסף המוצלח הזה שעושה זאת נפלא.

                P תגובה 1 תגובה אחרונה
                1
                • ד דאנציג

                  @מאקרו
                  לא עובד לי.

                  יש לציין לתוסף המוצלח הזה שעושה זאת נפלא.

                  P מנותק
                  P מנותק
                  pcinfogmach
                  מדריכים
                  כתב ב נערך לאחרונה על ידי pcinfogmach
                  #27

                  @דאנציג כתב בשיתוף | אינצקלופדיה שיתופית עבור קודים של מאקרו - איך עושים את....:

                  וכאן המקום לשאול, כיצד ניתן להרחיב את הסוגריים עד סוף המילה אפילו כאשר עומדים באמצעה.

                  Selection.MoveEndUntil Cset:=" ", Count:=wdForward
                  Selection.MoveStartUntil Cset:=" ", Count:=wdBackward
                  Selection.text = "(" & Selection.text & ")"
                  

                  או אפשר ככה למי שמעדיף

                  With Selection
                      .MoveEndUntil Cset:=" ", Count:=wdForward
                      .MoveStartUntil Cset:=" ", Count:=wdBackward
                      .text = "(" & .text & ")"
                  End With
                  

                  משום מה במילים ארוכות באנגלית הוא עושה קצת בעיות 😞

                  תגובה 1 תגובה אחרונה
                  2
                  • P pcinfogmach

                    קוד להוספת כותרות צד

                    Option Explicit
                    Sub כותרות_צד()
                    
                    
                    Dim numColumns As Integer, currentPara As Paragraph, slctd As Range _
                            
                    'set range
                    Set slctd = Selection.Range
                    
                    'start loop
                    For Each currentPara In slctd.Paragraphs
                    Application.ScreenUpdating = False
                    currentPara.Range.Select
                    
                    'get column width
                        numColumns = ActiveDocument.PageSetup.TextColumns.Count
                        If numColumns = 2 Then
                            Dim columnWidth As Single
                            Dim columnWidth2 As Single
                            columnWidth = ActiveDocument.PageSetup.TextColumns.Item(1).Width
                            columnWidth2 = ActiveDocument.PageSetup.TextColumns.Item(2).Width
                        End If
                        
                    'exceptions
                    If Not currentPara.Range.ComputeStatistics(wdStatisticLines) > 1 _
                    Or Not currentPara.Range.ComputeStatistics(wdStatisticLines) > 2 Then GoTo nxt
                    
                    'Get the first sentence of the current paragraph
                        Dim firstSentence As String
                        Dim words() As String
                        words = Split(currentPara.Range.Text, " ")
                        firstSentence = words(0) & " " & words(1) & " " & words(2) & " " _
                        & words(3) & " " & words(4) & " " & words(5)
                        
                    'get font size set box font size and calc misalignment adjustment accordingly
                        Dim fontSize, x, y, z As Single
                        fontSize = currentPara.Range.Font.SizeBi - 4
                        x = currentPara.Range.Font.SizeBi
                        y = x - 8
                        z = y * 0.4
                        'MsgBox z
                    
                    '
                    'Dim spaceWidth As Double
                    'spaceWidth = currentPara.Range.font.spacing
                    'Dim spaceWidth As Double
                    'spaceWidth = ActiveDocument.PageSetup.TextColumns.spacing / 2
                    '
                        
                        'get middle of page
                        Dim mrgn As Double
                        mrgn = ActiveDocument.PageSetup.LeftMargin / 2
                    
                        Dim newShape As Shape
                        'left column - if para calc is smaller then middle of page
                        If ActiveDocument.PageSetup.PageWidth / 2 > currentPara.Range.Information(wdHorizontalPositionRelativeToPage) Then
                        Set newShape = ActiveDocument.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
                                Left:=currentPara.Range.Information(wdHorizontalPositionRelativeToPage) - columnWidth2 - mrgn, _
                                Top:=currentPara.Range.Information(wdVerticalPositionRelativeToPage), _
                                Width:=mrgn, Height:=50)
                            newShape.TextFrame.TextRange.ParagraphFormat.Alignment = wdAlignParagraphRight
                            End If
                            
                        'right column - if para calc is larger
                        If ActiveDocument.PageSetup.PageWidth / 2 < currentPara.Range.Information(wdHorizontalPositionRelativeToPage) Then
                            Set newShape = ActiveDocument.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, _
                                Left:=currentPara.Range.Information(wdHorizontalPositionRelativeToPage), _
                                Top:=currentPara.Range.Information(wdVerticalPositionRelativeToPage), _
                                Width:=mrgn, Height:=50)
                        newShape.TextFrame.TextRange.ParagraphFormat.Alignment = wdAlignParagraphLeft
                       
                        End If
                           'newShape.TextFrame.MarginLeft = 0
                           'newShape.TextFrame.MarginRight = 0
                            newShape.TextFrame.MarginTop = z 'adjust misalignment
                            newShape.TextFrame.MarginBottom = 0
                            newShape.Line.Visible = msoFalse
                            newShape.TextFrame.TextRange.Text = firstSentence
                            newShape.TextFrame.TextRange.Font.SizeBi = 8
                            newShape.TextFrame.AutoSize = True
                            
                    
                        'tiny adjustment
                            If ActiveDocument.PageSetup.PageWidth / 2 > currentPara.Range.Information(wdHorizontalPositionRelativeToPage) Then
                            newShape.TextFrame.MarginTop = newShape.TextFrame.MarginTop - 0.1
                            Else
                            newShape.TextFrame.MarginTop = newShape.TextFrame.MarginTop - 0.05
                            newShape.TextFrame.MarginLeft = newShape.TextFrame.MarginLeft + 0.04
                            End If
                            
                    nxt:
                    Application.ScreenUpdating = True
                    Application.ScreenRefresh
                        Next currentPara
                        
                        End Sub
                        
                    Sub מחק_כותרת_צד_בכל_המסמך()
                        Dim shp As Shape, i As Integer, shppos, mrgnright, mrgnleft As Single
                            
                            mrgnleft = ActiveDocument.PageSetup.LeftMargin
                            mrgnright = ActiveDocument.PageSetup.PageWidth - mrgnleft
                        
                        For i = ActiveDocument.Shapes.Count To 1 Step -1
                            Set shp = ActiveDocument.Shapes(i)
                            shppos = shp.TextFrame.TextRange.Information(wdHorizontalPositionRelativeToPage)
                            
                            If shppos > mrgnright Or shppos < mrgnleft _
                            And shp.Type = msoTextBox And shp.Line.Visible = msoFalse Then
                             'And shp.Width = ActiveDocument.PageSetup.LeftMargin / 2 Then
                                shp.Delete
                            End If
                        
                        Next i
                        End Sub
                    
                    Sub מחק_כותרות_צד_בעמוד_זה()
                    Dim shp As Shape, i, currentPage As Integer, _
                    shppos, mrgnright, mrgnleft As Single
                        
                        mrgnleft = ActiveDocument.PageSetup.LeftMargin
                        mrgnright = ActiveDocument.PageSetup.PageWidth - mrgnleft
                        
                        currentPage = Selection.Information(wdActiveEndPageNumber)
                        Application.ScreenUpdating = False
                        For Each shp In ActiveDocument.Shapes
                            shppos = shp.TextFrame.TextRange.Information(wdHorizontalPositionRelativeToPage)
                            If shp.Anchor.Information(wdActiveEndPageNumber) = currentPage And _
                            shppos > mrgnright Or shppos < mrgnleft _
                            And shp.Type = msoTextBox And shp.Line.Visible = msoFalse _
                            And shp.Anchor.Information(wdActiveEndPageNumber) = currentPage Then
                                shp.Select (False)
                            End If
                        Next shp
                        Application.ScreenUpdating = True
                        Selection.Delete Unit:=wdCharacter, Count:=1
                    End Sub
                    
                    
                    
                    
                    
                    
                    
                    menajemmendelM מנותק
                    menajemmendelM מנותק
                    menajemmendel
                    כתב ב נערך לאחרונה על ידי menajemmendel
                    #28

                    @pcinfogmach כתב בשיתוף | אינצקלופדיה שיתופית עבור קודים של מאקרו - איך עושים את....:

                    קוד להוספת כותרות צד

                    לא הבנתי מה בדיוק המטרה של זה, מה רע בליצור סגנון במסגרת??

                    P תגובה 1 תגובה אחרונה
                    0
                    • menajemmendelM menajemmendel

                      @pcinfogmach כתב בשיתוף | אינצקלופדיה שיתופית עבור קודים של מאקרו - איך עושים את....:

                      קוד להוספת כותרות צד

                      לא הבנתי מה בדיוק המטרה של זה, מה רע בליצור סגנון במסגרת??

                      P מנותק
                      P מנותק
                      pcinfogmach
                      מדריכים
                      כתב ב נערך לאחרונה על ידי
                      #29
                      פוסט זה נמחק!
                      menajemmendelM תגובה 1 תגובה אחרונה
                      0
                      • P pcinfogmach

                        פוסט זה נמחק!

                        menajemmendelM מנותק
                        menajemmendelM מנותק
                        menajemmendel
                        כתב ב נערך לאחרונה על ידי
                        #30

                        @pcinfogmach האם זה מה שאתה רוצה לעשות? 4fb55ffd-2eb6-46e6-8f39-b707ef152974-image.png

                        P תגובה 1 תגובה אחרונה
                        1
                        • menajemmendelM menajemmendel

                          @pcinfogmach האם זה מה שאתה רוצה לעשות? 4fb55ffd-2eb6-46e6-8f39-b707ef152974-image.png

                          P מנותק
                          P מנותק
                          pcinfogmach
                          מדריכים
                          כתב ב נערך לאחרונה על ידי pcinfogmach
                          #31
                          פוסט זה נמחק!
                          תגובה 1 תגובה אחרונה
                          0
                          • P מנותק
                            P מנותק
                            pcinfogmach
                            מדריכים
                            כתב ב נערך לאחרונה על ידי pcinfogmach
                            #32

                            הקטנת והגדלת סוגריים
                            מאחר ומדובר ביוזרפורם אני מעלה את הקובץ במקום קוד
                            יש לחלץ את כל הקבצים ואז להתקין את הקובץ frm

                            עריכה: גירסה מעודכנת
                            MyParenthesis.zip

                            ד תגובה 1 תגובה אחרונה
                            0
                            • P pcinfogmach

                              הקטנת והגדלת סוגריים
                              מאחר ומדובר ביוזרפורם אני מעלה את הקובץ במקום קוד
                              יש לחלץ את כל הקבצים ואז להתקין את הקובץ frm

                              עריכה: גירסה מעודכנת
                              MyParenthesis.zip

                              ד מנותק
                              ד מנותק
                              דאנציג
                              כתב ב נערך לאחרונה על ידי דאנציג
                              #33

                              @pcinfogmach כתב בשיתוף | אינצקלופדיה שיתופית עבור קודים של מאקרו - איך עושים את....:

                              הקטנת והגדלת סוגריים
                              מאחר ומדובר ביוזרפורם אני מעלה את הקובץ frm במקום קוד
                              Parenthesis.frm

                              Errors during load. Refer to
                              Line 8: Property OleObjectBlob in Parenthesis had an invalid file reference.

                              P תגובה 1 תגובה אחרונה
                              0
                              • ד דאנציג

                                @pcinfogmach כתב בשיתוף | אינצקלופדיה שיתופית עבור קודים של מאקרו - איך עושים את....:

                                הקטנת והגדלת סוגריים
                                מאחר ומדובר ביוזרפורם אני מעלה את הקובץ frm במקום קוד
                                Parenthesis.frm

                                Errors during load. Refer to
                                Line 8: Property OleObjectBlob in Parenthesis had an invalid file reference.

                                P מנותק
                                P מנותק
                                pcinfogmach
                                מדריכים
                                כתב ב נערך לאחרונה על ידי pcinfogmach
                                #34

                                @דאנציג
                                נראה לי שיש לו קובץ תומך שהיה חסר נסה עכשיו

                                ד תגובה 1 תגובה אחרונה
                                0
                                • P pcinfogmach

                                  @דאנציג
                                  נראה לי שיש לו קובץ תומך שהיה חסר נסה עכשיו

                                  ד מנותק
                                  ד מנותק
                                  דאנציג
                                  כתב ב נערך לאחרונה על ידי
                                  #35

                                  @pcinfogmach
                                  את הקובץ עם הסיומת FRX ויז'ואל בייסיק לא נותן להוסיף עם השגיאה הנ"ל.
                                  הקובץ השני מוסיף את זה:
                                  11b1ab36-29ef-40a4-84ee-151bf0fefb3d-image.png

                                  P תגובה 1 תגובה אחרונה
                                  0
                                  • ד דאנציג

                                    @pcinfogmach
                                    את הקובץ עם הסיומת FRX ויז'ואל בייסיק לא נותן להוסיף עם השגיאה הנ"ל.
                                    הקובץ השני מוסיף את זה:
                                    11b1ab36-29ef-40a4-84ee-151bf0fefb3d-image.png

                                    P מנותק
                                    P מנותק
                                    pcinfogmach
                                    מדריכים
                                    כתב ב נערך לאחרונה על ידי
                                    #36

                                    @דאנציג
                                    מצויין כמו שאמרתי ה- frx לא אמור להיות מותקן הוא רק קובץ תומך

                                    ד תגובה 1 תגובה אחרונה
                                    0
                                    • P pcinfogmach

                                      @דאנציג
                                      מצויין כמו שאמרתי ה- frx לא אמור להיות מותקן הוא רק קובץ תומך

                                      ד מנותק
                                      ד מנותק
                                      דאנציג
                                      כתב ב נערך לאחרונה על ידי דאנציג
                                      #37

                                      @pcinfogmach והיכן הוא אמור להיות?
                                      בSTARTUP, או בTemplates?
                                      אגב, זה בדיוק הקובץ של הקטנת והגדלת סוגריים של ניקיוזר, אך אם אני לא נותן לו את פקודת המאקרו, כיצד הוא יפעל?

                                      P תגובה 1 תגובה אחרונה
                                      0
                                      • ד דאנציג

                                        @pcinfogmach והיכן הוא אמור להיות?
                                        בSTARTUP, או בTemplates?
                                        אגב, זה בדיוק הקובץ של הקטנת והגדלת סוגריים של ניקיוזר, אך אם אני לא נותן לו את פקודת המאקרו, כיצד הוא יפעל?

                                        P מנותק
                                        P מנותק
                                        pcinfogmach
                                        מדריכים
                                        כתב ב נערך לאחרונה על ידי pcinfogmach
                                        #38

                                        @דאנציג כתב בשיתוף | אינצקלופדיה שיתופית עבור קודים של מאקרו - איך עושים את....:

                                        @pcinfogmach והיכן הוא אמור להיות?
                                        בSTARTUP, או בTemplates?

                                        אם אתה רוצה שיאתחל עם וורד אז בstartup או פשוט תוסיף אותו לתבנית נורמל.

                                        אגב, זה בדיוק הקובץ של הקטנת והגדלת סוגריים של ניקיוזר,

                                        זה דומה אבל לא בדיוק השמטתי חלק מהאפשרויות והוספתי פונקציות ועשיתי קוד חדש, יותר פשוט ונקי.

                                        אך אם אני לא נותן לו את פקודת המאקרו, כיצד הוא יפעל?

                                        צודק 🙂
                                        היה עוד בעיה שתוקנה עכשיו עם השם של היוזרפורם

                                        ולהוסיף בתוך מודול רגיל קוד כזה

                                        Sub Parenthesis()
                                        MyParenthesis.Show
                                        End Sub
                                        
                                        תגובה 1 תגובה אחרונה
                                        0
                                        • P מנותק
                                          P מנותק
                                          pcinfogmach
                                          מדריכים
                                          כתב ב נערך לאחרונה על ידי pcinfogmach
                                          #39

                                          הגדל והקטן רווחים בין מילים בפיסקאות שנבחרו
                                          עריכה: הקוד שופץ ונערך מחדש על פי ההצעה של @מאקרו
                                          עריכה2: הקוד שימושי ליישור טורים ,אם חסר שורה בין הטורים אפשר כך להוסיף שורה בלי שיורגש...

                                          Option Explicit
                                          Sub הגדל_רווחים_בין_מילים()
                                              Dim rng, para, spaceRange As Range, i As Integer
                                              
                                              Set rng = Selection.Range
                                              
                                              'loop throgh pragraphs
                                              For i = 1 To rng.Paragraphs.Count
                                              Set para = rng.Paragraphs(i).Range
                                              Set spaceRange = para.Duplicate
                                              
                                              ' Loop through each space in the selected paragraph
                                              Do While spaceRange.InRange(para)
                                                  spaceRange.MoveStartUntil " " ' Move to the next space
                                                      If spaceRange.InRange(para) Then _
                                                          spaceRange.Characters(1).Font.Spacing = spaceRange.Characters(1).Font.Spacing + 1
                                                             spaceRange.MoveStart unit:=wdCharacter, Count:=1 ' Move to the next character
                                              Loop
                                              
                                              Next i
                                              
                                          End Sub
                                          
                                          
                                          Sub הקטן_רווחים_בין_מילים()
                                              Dim rng, para, spaceRange As Range, i As Integer
                                              
                                              Set rng = Selection.Range
                                              
                                              'loop throgh pragraphs
                                              For i = 1 To rng.Paragraphs.Count
                                              Set para = rng.Paragraphs(i).Range
                                              Set spaceRange = para.Duplicate
                                              
                                              ' Loop through each space in the selected paragraph
                                              Do While spaceRange.InRange(para)
                                                  spaceRange.MoveStartUntil " " ' Move to the next space
                                                      If spaceRange.InRange(para) Then _
                                                          spaceRange.Characters(1).Font.Spacing = spaceRange.Characters(1).Font.Spacing - 1
                                                             spaceRange.MoveStart unit:=wdCharacter, Count:=1 ' Move to the next character
                                              Loop
                                              
                                              Next i
                                              
                                          End Sub
                                          
                                          

                                          עריכה 3:
                                          והנה קוד בשיטה אחרת לפי ההצעה של @menajemmendel קוד זה נערך על ידי ושופץ בעזרת @מאקרו

                                          Sub ChangeSpacing()
                                          Dim myrange As Range, orange As Range
                                          Set myrange = Selection.Range
                                          myrange.SetRange Selection.Paragraphs.First.Range.Start, Selection.Paragraphs.Last.Range.End
                                          Set orange = ActiveDocument.Range(myrange.Start, myrange.End)
                                          
                                          With orange
                                          .Collapse
                                          .MoveUntil cset:=" "
                                          .SetRange Start:=.Start, End:=.Start + 1
                                          .Select
                                          End With
                                          
                                          Dim c As Font, rslt As Integer
                                          Set c = Selection.Font
                                          rslt = c.Spacing + 1
                                          
                                          With myrange.Find
                                          .ClearFormatting
                                          .Replacement.ClearFormatting
                                          .Replacement.Font.Spacing = rslt
                                          .Text = " "
                                          .Replacement.Text = "^&"
                                          .Forward = False
                                          .Wrap = wdFindStop
                                          .Format = True
                                          End With
                                          myrange.Find.Execute Replace:=wdReplaceAll
                                          End Sub
                                          
                                          
                                          menajemmendelM תגובה 1 תגובה אחרונה
                                          2

                                          • התחברות

                                          • אין לך חשבון עדיין? הרשמה

                                          • התחברו או הירשמו כדי לחפש.
                                          • פוסט ראשון
                                            פוסט אחרון
                                          0
                                          • חוקי הפורום
                                          • לא נפתר
                                          • משתמשים
                                          • חיפוש גוגל בפורום
                                          • צור קשר