Dreamweaver
Well-known member
- Local time
- Today, 00:46
- Joined
- Nov 28, 2005
- Messages
- 2,466
I use onedrive but yes I thought that might be the only way I'll check my onedrive as haven't run that code in years that is if i can even find it lol
Private Sub SpanFolders(SourceFolderFullName As String, Optional ParentID As Long = 0, Optional ByVal FolderLevel = 0)
' lists information about the files in SourceFolder
' example: ListFilesInFolder "C:\FolderName\", True
'Dim FSO As Object 'Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder 'Scripting.Folder
Dim SubFolder As Scripting.Folder 'Scripting.Folder
Dim FileItem As Scripting.file 'Scripting.File
' Dim ParentID As Long
Set SourceFolder = FSO.GetFolder(SourceFolderFullName)
FolderLevel = FolderLevel + 1
LogFilesFolders SourceFolder.Name, SourceFolder.Path, SourceFolder.Type, ParentID, fft_Folder, FolderLevel
ParentID = GetFolderID(SourceFolder.Path)
For Each FileItem In SourceFolder.Files
If (FileItem.Attributes And 2) <> 2 And (FileItem.Attributes And 4) <> 4 Then
LogFilesFolders FileItem.Name, FileItem.Path, FileItem.Type, ParentID, fft_File, FolderLevel
End If
Next FileItem
For Each SubFolder In SourceFolder.SubFolders
ParentID = GetFolderID(SourceFolder.Path) ' The record has just been added so get PK by name
' LogFilesFolders SubFolder.Name, SubFolder.Path, SubFolder.Type, ParentID, fft_Folder, FolderLevel
If (SubFolder.Attributes And 2) <> 2 And (SubFolder.Attributes And 4) <> 4 Then
SpanFolders SubFolder.Path, ParentID, FolderLevel
End If
Next SubFolder
Set FileItem = Nothing
Set SourceFolder = Nothing
End Sub
Private Sub SpanFolderSummations(SourceFolderFullName As String, Optional ParentID As Long = 0, Optional ByVal FolderLevel = 0, Optional CountHiddenSystem As Boolean = False)
' lists information about the files in SourceFolder
' example: ListFilesInFolder "C:\FolderName\", True
'Dim FSO As Object 'Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder 'Scripting.Folder
Dim SubFolder As Scripting.Folder 'Scripting.Folder
Dim FileItem As Scripting.file 'Scripting.File
Dim FolderCount As Long
Dim FileCount As Long
FolderLevel = FolderLevel + 1
Set SourceFolder = FSO.GetFolder(SourceFolderFullName)
FolderCount = SourceFolder.SubFolders.Count
If CountHiddenSystem Then
FileCount = SubFolder.Files.Count 'This will count hidden as well
Else
FileCount = 0
For Each FileItem In SourceFolder.Files
If (FileItem.Attributes And 2) <> 2 And (FileItem.Attributes And 4) <> 4 Then
FileCount = FileCount + 1
End If
Next FileItem
End If
LogFolderSummations SourceFolder.Name, SourceFolder.Path, FolderCount, FileCount, ParentID, FolderLevel
For Each SubFolder In SourceFolder.SubFolders
ParentID = GetFolderSummationID(SourceFolder.Path)
'FolderCount = SubFolder.SubFolders.Count
If (SubFolder.Attributes And 2) <> 2 And (SubFolder.Attributes And 4) <> 4 Then
SpanFolderSummations SubFolder.Path, ParentID, FolderLevel
End If
Next SubFolder
Set FileItem = Nothing
Set SourceFolder = Nothing
End Sub
These come with the JPK Treeview and I did not build them. You probably can get rid of them once you built the Tree. However if you import your forms into an existing database you will need to bring these and the modStartup. Or in Vba export the USERFORM UfTreeview and then in VBA reenter. You cannot import this the normal way.And finally. Can I do without the two macros AutoExec and CheckTrust? From what I'm seeing, they don't contribute anything.
Private Sub SpanFolderSummations(SourceFolderFullName As String, Optional ParentID As Long = 0, Optional ByVal FolderLevel = 0, Optional CountHiddenSystem As Boolean = False)
' lists information about the files in SourceFolder
' example: ListFilesInFolder "C:\FolderName\", True
'Dim FSO As Object 'Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder 'Scripting.Folder
Dim SubFolder As Scripting.Folder 'Scripting.Folder
Dim FileItem As Scripting.file 'Scripting.File
Dim FolderCount As Long
Dim FileCount As Long
FolderLevel = FolderLevel + 1
Set SourceFolder = FSO.GetFolder(SourceFolderFullName)
If CountHiddenSystem Then
FolderCount = SourceFolder.SubFolders.Count
Else
FolderCount = 0
For Each SubFolder In SourceFolder.SubFolders
If (SubFolder.Attributes And 2) <> 2 And (SubFolder.Attributes And 4) <> 4 Then
FolderCount = FolderCount + 1
End If
Next SubFolder
End If
If CountHiddenSystem Then
FileCount = SubFolder.Files.Count 'This will count hidden as well
Else
FileCount = 0
For Each FileItem In SourceFolder.Files
If (FileItem.Attributes And 2) <> 2 And (FileItem.Attributes And 4) <> 4 Then
FileCount = FileCount + 1
End If
Next FileItem
End If
LogFolderSummations SourceFolder.Name, SourceFolder.Path, FolderCount, FileCount, ParentID, FolderLevel
For Each SubFolder In SourceFolder.SubFolders
ParentID = GetFolderSummationID(SourceFolder.Path)
'FolderCount = SubFolder.SubFolders.Count
If (SubFolder.Attributes And 2) <> 2 And (SubFolder.Attributes And 4) <> 4 Then
SpanFolderSummations SubFolder.Path, ParentID, FolderLevel
End If
Next SubFolder
Set FileItem = Nothing
Set SourceFolder = Nothing
End Sub
Of course you can have it span the files automatically. The question is do you really want to do that all the time. Once you have read the directory once you do not have to read again until files/folders have been added or removed. If this is a very big folder you may not want to load every time. If it is small then you might. Look at the code in the OK button of the application settings. It automatically clears the tables, spans, and opens the tree. I have it update everytime you open the form to change the path. I added one more top level procedure to do all of that.Is it possible that when I enter I update automatically without me having to give ReadFiles?
There is a method to expand the children of a node. I would have to write a method to call that procedure. I would have to look how to code it.And on the other hand, can the unfolded tree be opened? That is, like this:
If you could do it. I don't know how to do it.There is a method to expand the children of a node. I would have to write a method to call that procedure. I would have to look how to code it.
I am still working this. I tried using the Expanded property but nothing happened.If you could do it. I don't know how to do it
No problem. I am quite aware of the time differences on this forum. I have helped develop large database here for people in New Zealand, Japan, Eastern and Western Europe, South Pacific, South America you name it.Hi. Good Morning. First of all, sorry for answering you now.