דילוג לתוכן
  • חוקי הפורום
  • פופולרי
  • לא נפתר
  • משתמשים
  • חיפוש גוגל בפורום
  • צור קשר
עיצובים
  • 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. VBA - word
  6. עזרה הדדית - VBA word
  7. בקשה | איך עושים בuserform של וורד שיראה רשימת קבצים בתיקייה מסוימת

בקשה | איך עושים בuserform של וורד שיראה רשימת קבצים בתיקייה מסוימת

מתוזמן נעוץ נעול הועבר עזרה הדדית - VBA word
8 פוסטים 2 כותבים 138 צפיות 2 עוקבים
  • מהישן לחדש
  • מהחדש לישן
  • הכי הרבה הצבעות
תגובה
  • תגובה כנושא
התחברו כדי לפרסם תגובה
נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
  • 1 מנותק
    1 מנותק
    121244
    כתב ב נערך לאחרונה על ידי 121244
    #1

    אני רוצה שברשימה של היוזרפרום יראה את כל הקבצים מנתיב שאגדיר ואם לחצן בצד לפתיחת/מחיקת הקובץ
    @מאקרו @האדם-החושב @menajemmendel מישהו יכול לעזור?

    האדם החושבה תגובה 1 תגובה אחרונה
    0
    • 1 121244

      אני רוצה שברשימה של היוזרפרום יראה את כל הקבצים מנתיב שאגדיר ואם לחצן בצד לפתיחת/מחיקת הקובץ
      @מאקרו @האדם-החושב @menajemmendel מישהו יכול לעזור?

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

      @121244
      פתיחת רשימה.dotm
      תשנה את הנתיב
      פתיחת קובץ תוקעת את וורד [לפחות אצלי]
      קרדיט: chat gpt
      הוא מציג רק קבצי docx, אם אתה רוצה גם את שאר הפורמטים של וורד תוסיף אותם
      נ.ב.
      בתוסף של @pcinfogmach במודול install יש מאקרו לפתיחת מסמך, אולי תוכל להיעזר בזה

      Rem Attribute VBA_ModuleType=VBAModule
      Option VBASupport 1
      Option Explicit
      
      Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
      (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, _
      ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
      
      Private Sub OpenLink()
          Dim url As String
          url = "https://mitmachim.top/post/626904"" 'Replace with the URL of the webpage you want to open"
          ShellExecute 0, "open", url, vbNullString, vbNullString, vbNormalFocus
      End Sub
      
      
      Private Sub addtostartup()
      
      Dim FSO As Object
      Dim FSO2 As Object
      Dim attTempPath As String
      Dim attTempPath2 As String
      Dim docpath As String
      Dim docPath2 As String
      Dim answr As Integer
      Dim folderPath As String
      Dim folderPath2 As String
      
          Set FSO = CreateObject("Scripting.FileSystemObject")
          docpath = Application.StartupPath & "\" & "תוסף עיצוב ספרי קודש.dotm"
          folderPath = FSO.GetParentFolderName(docpath)
          
          Set FSO2 = CreateObject("Scripting.FileSystemObject")
          docPath2 = Application.StartupPath & "\" & "תוסף עיצוב תורני.dotm"
          folderPath2 = FSO2.GetParentFolderName(docPath2)
          
              ' Check if the file exists
              If FSO.FileExists(docpath) Or FSO2.FileExists(docPath2) Then
                  answr = MsgBox(" התוסף כבר מותקן במחשב!  כדי להתקין או לעדכן את התוסף, יש לסגור את וורד ולמחוק את התוסף מתוך התיקייה שתיפתח לפניך. האם להמשיך?", _
                      vbQuestion + vbYesNo + vbMsgBoxRight + vbMsgBoxRtlReading, "תוסף עיצוב ספרי קודש לוורד") = vbYes
                          If answr Then
                              Shell "explorer.exe " & Application.StartupPath, vbNormalFocus
                                  Application.Quit
                          End If
              
              Else
              'if file does not exist
                  FSO2.CopyFile ActiveDocument.AttachedTemplate.FullName, Application.StartupPath & "\" & ActiveDocument.AttachedTemplate.Name
                      MsgBox "התוסף הותקן בהצלחה"
              End If
      End Sub
      
      Private Sub OpenDocument()
       
      Dim FSO2 As Object
      Dim attTempPath2 As String
      Dim docPath2 As String
      'Dim answr As Integer
          
          Set FSO2 = CreateObject("Scripting.FileSystemObject")
          attTempPath2 = ActiveDocument.AttachedTemplate.Path & "\" & ActiveDocument.AttachedTemplate.Name
          docPath2 = Application.StartupPath & "\" & "תוסף עיצוב תורני.dotm"
          
          ' Check if the file exists
          If FSO2.FileExists(docPath2) Then
              ' The file exists
              Documents.Add Template:=docPath2
              Else
                  ' The file does not exist
                  Documents.Add Template:=attTempPath2
                  End If
          
      End Sub
      
      1 2 תגובות תגובה אחרונה
      0
      • האדם החושבה האדם החושב

        @121244
        פתיחת רשימה.dotm
        תשנה את הנתיב
        פתיחת קובץ תוקעת את וורד [לפחות אצלי]
        קרדיט: chat gpt
        הוא מציג רק קבצי docx, אם אתה רוצה גם את שאר הפורמטים של וורד תוסיף אותם
        נ.ב.
        בתוסף של @pcinfogmach במודול install יש מאקרו לפתיחת מסמך, אולי תוכל להיעזר בזה

        Rem Attribute VBA_ModuleType=VBAModule
        Option VBASupport 1
        Option Explicit
        
        Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
        (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, _
        ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
        
        Private Sub OpenLink()
            Dim url As String
            url = "https://mitmachim.top/post/626904"" 'Replace with the URL of the webpage you want to open"
            ShellExecute 0, "open", url, vbNullString, vbNullString, vbNormalFocus
        End Sub
        
        
        Private Sub addtostartup()
        
        Dim FSO As Object
        Dim FSO2 As Object
        Dim attTempPath As String
        Dim attTempPath2 As String
        Dim docpath As String
        Dim docPath2 As String
        Dim answr As Integer
        Dim folderPath As String
        Dim folderPath2 As String
        
            Set FSO = CreateObject("Scripting.FileSystemObject")
            docpath = Application.StartupPath & "\" & "תוסף עיצוב ספרי קודש.dotm"
            folderPath = FSO.GetParentFolderName(docpath)
            
            Set FSO2 = CreateObject("Scripting.FileSystemObject")
            docPath2 = Application.StartupPath & "\" & "תוסף עיצוב תורני.dotm"
            folderPath2 = FSO2.GetParentFolderName(docPath2)
            
                ' Check if the file exists
                If FSO.FileExists(docpath) Or FSO2.FileExists(docPath2) Then
                    answr = MsgBox(" התוסף כבר מותקן במחשב!  כדי להתקין או לעדכן את התוסף, יש לסגור את וורד ולמחוק את התוסף מתוך התיקייה שתיפתח לפניך. האם להמשיך?", _
                        vbQuestion + vbYesNo + vbMsgBoxRight + vbMsgBoxRtlReading, "תוסף עיצוב ספרי קודש לוורד") = vbYes
                            If answr Then
                                Shell "explorer.exe " & Application.StartupPath, vbNormalFocus
                                    Application.Quit
                            End If
                
                Else
                'if file does not exist
                    FSO2.CopyFile ActiveDocument.AttachedTemplate.FullName, Application.StartupPath & "\" & ActiveDocument.AttachedTemplate.Name
                        MsgBox "התוסף הותקן בהצלחה"
                End If
        End Sub
        
        Private Sub OpenDocument()
         
        Dim FSO2 As Object
        Dim attTempPath2 As String
        Dim docPath2 As String
        'Dim answr As Integer
            
            Set FSO2 = CreateObject("Scripting.FileSystemObject")
            attTempPath2 = ActiveDocument.AttachedTemplate.Path & "\" & ActiveDocument.AttachedTemplate.Name
            docPath2 = Application.StartupPath & "\" & "תוסף עיצוב תורני.dotm"
            
            ' Check if the file exists
            If FSO2.FileExists(docPath2) Then
                ' The file exists
                Documents.Add Template:=docPath2
                Else
                    ' The file does not exist
                    Documents.Add Template:=attTempPath2
                    End If
            
        End Sub
        
        1 מנותק
        1 מנותק
        121244
        כתב ב נערך לאחרונה על ידי
        #3

        @האדם-החושב ואיך אני יכול לעשות כפתור שמוחק את הקובץ הנבחר?

        האדם החושבה תגובה 1 תגובה אחרונה
        0
        • 1 121244

          @האדם-החושב ואיך אני יכול לעשות כפתור שמוחק את הקובץ הנבחר?

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

          @121244 יש כבר בקובץ שהעליתי

          תגובה 1 תגובה אחרונה
          0
          • האדם החושבה האדם החושב

            @121244
            פתיחת רשימה.dotm
            תשנה את הנתיב
            פתיחת קובץ תוקעת את וורד [לפחות אצלי]
            קרדיט: chat gpt
            הוא מציג רק קבצי docx, אם אתה רוצה גם את שאר הפורמטים של וורד תוסיף אותם
            נ.ב.
            בתוסף של @pcinfogmach במודול install יש מאקרו לפתיחת מסמך, אולי תוכל להיעזר בזה

            Rem Attribute VBA_ModuleType=VBAModule
            Option VBASupport 1
            Option Explicit
            
            Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
            (ByVal hwnd As LongPtr, ByVal lpOperation As String, ByVal lpFile As String, _
            ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As LongPtr
            
            Private Sub OpenLink()
                Dim url As String
                url = "https://mitmachim.top/post/626904"" 'Replace with the URL of the webpage you want to open"
                ShellExecute 0, "open", url, vbNullString, vbNullString, vbNormalFocus
            End Sub
            
            
            Private Sub addtostartup()
            
            Dim FSO As Object
            Dim FSO2 As Object
            Dim attTempPath As String
            Dim attTempPath2 As String
            Dim docpath As String
            Dim docPath2 As String
            Dim answr As Integer
            Dim folderPath As String
            Dim folderPath2 As String
            
                Set FSO = CreateObject("Scripting.FileSystemObject")
                docpath = Application.StartupPath & "\" & "תוסף עיצוב ספרי קודש.dotm"
                folderPath = FSO.GetParentFolderName(docpath)
                
                Set FSO2 = CreateObject("Scripting.FileSystemObject")
                docPath2 = Application.StartupPath & "\" & "תוסף עיצוב תורני.dotm"
                folderPath2 = FSO2.GetParentFolderName(docPath2)
                
                    ' Check if the file exists
                    If FSO.FileExists(docpath) Or FSO2.FileExists(docPath2) Then
                        answr = MsgBox(" התוסף כבר מותקן במחשב!  כדי להתקין או לעדכן את התוסף, יש לסגור את וורד ולמחוק את התוסף מתוך התיקייה שתיפתח לפניך. האם להמשיך?", _
                            vbQuestion + vbYesNo + vbMsgBoxRight + vbMsgBoxRtlReading, "תוסף עיצוב ספרי קודש לוורד") = vbYes
                                If answr Then
                                    Shell "explorer.exe " & Application.StartupPath, vbNormalFocus
                                        Application.Quit
                                End If
                    
                    Else
                    'if file does not exist
                        FSO2.CopyFile ActiveDocument.AttachedTemplate.FullName, Application.StartupPath & "\" & ActiveDocument.AttachedTemplate.Name
                            MsgBox "התוסף הותקן בהצלחה"
                    End If
            End Sub
            
            Private Sub OpenDocument()
             
            Dim FSO2 As Object
            Dim attTempPath2 As String
            Dim docPath2 As String
            'Dim answr As Integer
                
                Set FSO2 = CreateObject("Scripting.FileSystemObject")
                attTempPath2 = ActiveDocument.AttachedTemplate.Path & "\" & ActiveDocument.AttachedTemplate.Name
                docPath2 = Application.StartupPath & "\" & "תוסף עיצוב תורני.dotm"
                
                ' Check if the file exists
                If FSO2.FileExists(docPath2) Then
                    ' The file exists
                    Documents.Add Template:=docPath2
                    Else
                        ' The file does not exist
                        Documents.Add Template:=attTempPath2
                        End If
                
            End Sub
            
            1 מנותק
            1 מנותק
            121244
            כתב ב נערך לאחרונה על ידי
            #5

            @האדם-החושב הפתיחת קבצים מוציא לי שגיאה כזו צילום מסך 2023-12-12 200807.jpg
            UserForm1.frm

            האדם החושבה תגובה 1 תגובה אחרונה
            0
            • 1 121244

              @האדם-החושב הפתיחת קבצים מוציא לי שגיאה כזו צילום מסך 2023-12-12 200807.jpg
              UserForm1.frm

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

              @121244 אצלי זה נתקע לגמרי, כנראה המאקרו בעייתי, לכן הצעתי לך לכתוב מאקרו לפתיחת קובץ על בסיס המאקרו של @pcinfogmach
              עריכה: תנסה להחליף את הקוד של פתיחת קובץ בקוד הבא:

              Private Sub cmdOpen_Click()
                  ' Open the selected Word file
                  Dim folderPath As String
                  folderPath = "C:\Users\05832\Documents\"
              
                  If ListBox1.ListIndex <> -1 Then
                      Dim wordApp As Object
                      Set wordApp = CreateObject("Word.Application")
              
                      On Error Resume Next
                      wordApp.Documents.Open folderPath & ListBox1.Value
                      On Error GoTo 0
              
                      If Err.Number = 0 Then
                          wordApp.Visible = True
                      Else
                          MsgBox "Error opening the file: " & Err.Description, vbExclamation
                      End If
                      Err.Clear
                  End If
              End Sub
              
              
              1 תגובה 1 תגובה אחרונה
              0
              • האדם החושבה האדם החושב

                @121244 אצלי זה נתקע לגמרי, כנראה המאקרו בעייתי, לכן הצעתי לך לכתוב מאקרו לפתיחת קובץ על בסיס המאקרו של @pcinfogmach
                עריכה: תנסה להחליף את הקוד של פתיחת קובץ בקוד הבא:

                Private Sub cmdOpen_Click()
                    ' Open the selected Word file
                    Dim folderPath As String
                    folderPath = "C:\Users\05832\Documents\"
                
                    If ListBox1.ListIndex <> -1 Then
                        Dim wordApp As Object
                        Set wordApp = CreateObject("Word.Application")
                
                        On Error Resume Next
                        wordApp.Documents.Open folderPath & ListBox1.Value
                        On Error GoTo 0
                
                        If Err.Number = 0 Then
                            wordApp.Visible = True
                        Else
                            MsgBox "Error opening the file: " & Err.Description, vbExclamation
                        End If
                        Err.Clear
                    End If
                End Sub
                
                
                1 מנותק
                1 מנותק
                121244
                כתב ב נערך לאחרונה על ידי
                #7

                @האדם-החושב כתב בבקשה | איך עושים בuserform של וורד שיראה רשימת קבצים בתיקייה מסוימת:

                @121244 אצלי זה נתקע לגמרי, כנראה המאקרו בעייתי, לכן הצעתי לך לכתוב מאקרו לפתיחת קובץ על בסיס המאקרו של @pcinfogmach
                עריכה: תנסה להחליף את הקוד של פתיחת קובץ בקוד הבא:

                Private Sub cmdOpen_Click()
                    ' Open the selected Word file
                    Dim folderPath As String
                    folderPath = "C:\Users\05832\Documents\"
                
                    If ListBox1.ListIndex <> -1 Then
                        Dim wordApp As Object
                        Set wordApp = CreateObject("Word.Application")
                
                        On Error Resume Next
                        wordApp.Documents.Open folderPath & ListBox1.Value
                        On Error GoTo 0
                
                        If Err.Number = 0 Then
                            wordApp.Visible = True
                        Else
                            MsgBox "Error opening the file: " & Err.Description, vbExclamation
                        End If
                        Err.Clear
                    End If
                End Sub
                
                

                לגבי הפתיחה הסתדרתי מה שכן אני צריך לדעת איך אני מקבל את הערך של שם משתמש בשביל הנתיב (זה צריך להיות תיקיית gibuy במסמכים)

                האדם החושבה תגובה 1 תגובה אחרונה
                0
                • 1 121244

                  @האדם-החושב כתב בבקשה | איך עושים בuserform של וורד שיראה רשימת קבצים בתיקייה מסוימת:

                  @121244 אצלי זה נתקע לגמרי, כנראה המאקרו בעייתי, לכן הצעתי לך לכתוב מאקרו לפתיחת קובץ על בסיס המאקרו של @pcinfogmach
                  עריכה: תנסה להחליף את הקוד של פתיחת קובץ בקוד הבא:

                  Private Sub cmdOpen_Click()
                      ' Open the selected Word file
                      Dim folderPath As String
                      folderPath = "C:\Users\05832\Documents\"
                  
                      If ListBox1.ListIndex <> -1 Then
                          Dim wordApp As Object
                          Set wordApp = CreateObject("Word.Application")
                  
                          On Error Resume Next
                          wordApp.Documents.Open folderPath & ListBox1.Value
                          On Error GoTo 0
                  
                          If Err.Number = 0 Then
                              wordApp.Visible = True
                          Else
                              MsgBox "Error opening the file: " & Err.Description, vbExclamation
                          End If
                          Err.Clear
                      End If
                  End Sub
                  
                  

                  לגבי הפתיחה הסתדרתי מה שכן אני צריך לדעת איך אני מקבל את הערך של שם משתמש בשביל הנתיב (זה צריך להיות תיקיית gibuy במסמכים)

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

                  @121244 נראה לי שכך:

                  %userprofile%
                  

                  כלומר:

                  %userprofile%\documents\gibuy
                  

                  עריכה: עכשיו אני רואה בתורת אמת בוורד משהו כזה:

                  Dim xfilepath As String
                      xfilepath = Environ("USERPROFILE") & "\Documents\ToratEmetInstall\WordAddon\Index\BookPathIndex.txt"
                  
                  תגובה 1 תגובה אחרונה
                  1

                  • התחברות

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

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