Hi there,
Any idea to Save Treeview content into Text file?
I wish to be able to save it in this style:
Thank you! ;)Code:[Caption 1]
- Element 1
- Element 2
[Caption 2]
- Element 1
- Element 2
[Caption 3]
- Element 1
- Element 2
Printable View
Hi there,
Any idea to Save Treeview content into Text file?
I wish to be able to save it in this style:
Thank you! ;)Code:[Caption 1]
- Element 1
- Element 2
[Caption 2]
- Element 1
- Element 2
[Caption 3]
- Element 1
- Element 2
Possibly useful link:
https://www.vbforums.com/showthread....w-to-Text-File
Try this one:
https://www.fortypoundhead.com/showc...sp?artid=48970
Link:
It sounds like your IP address is the banned one at that site. Try using a VPN to access it.Code:https://www.fortypoundhead.com/showcontent.asp?artid=48970
This is for VBA, but it should be similar to what you are looking for:
https://www.excelforum.com/excel-pro...-with-vba.html
http://vbcity.com/forums/t/6989.aspx
It seems too, weird think...
And big thank to you for helping me out here, I managed to get what I wish from the last link, but I can't figure out how to put new line after every new section.
Code:Public Sub SaveTreeViewToFile(objTW As TreeView, stFilename As String)
Dim mNode As node
Dim mChild As node
Dim frFile As Integer
frFile = FreeFile
Open stFilename For Output As #frFile
For Each mNode In objTW.Nodes
If mNode.Children > 0 Then
Print #frFile, "[" & mNode.Text & "]"
For Each mChild In objTW.Nodes
If mChild.Children = 0 Then
If mChild.Parent.Key = mNode.Key Then
Print #frFile, "- " & mChild.Text
End If
End If
Next
End If
Next
Close #frFile
Exit Sub
End Sub
Code:Public Sub SaveTreeViewToFile(objTW As TreeView, stFilename As String)
Dim mNode As node
Dim mChild As node
Dim frFile As Integer
frFile = FreeFile
Open stFilename For Output As #frFile
For Each mNode In objTW.Nodes
If mNode.Children > 0 Then
Print #frFile, "[" & mNode.Text & "]"
For Each mChild In objTW.Nodes
If mChild.Children = 0 Then
If mChild.Parent.Key = mNode.Key Then
Print #frFile, "- " & mChild.Text
End If
End If
Next
Print #frFile, ""
End If
Next
Close #frFile
Exit Sub
End Sub
Thank you so much! :) <3
Another to Save restore
https://github.com/dzzie/libs/tree/master/saveTreeView