|
-
Apr 4th, 2023, 02:09 PM
#1
Thread Starter
Addicted Member
[SOLVED] Save Treeview content into Text file
Hi there,
Any idea to Save Treeview content into Text file?
I wish to be able to save it in this style:
Code:
[Caption 1]
- Element 1
- Element 2
[Caption 2]
- Element 1
- Element 2
[Caption 3]
- Element 1
- Element 2
Thank you!
Last edited by beic; Apr 4th, 2023 at 04:17 PM.
-
Apr 4th, 2023, 02:22 PM
#2
Re: Save Treeview content into Text file
-
Apr 4th, 2023, 02:32 PM
#3
Thread Starter
Addicted Member
Re: Save Treeview content into Text file
 Originally Posted by jdc2000
Hardly, it's for .NET
-
Apr 4th, 2023, 03:00 PM
#4
Re: Save Treeview content into Text file
-
Apr 4th, 2023, 03:03 PM
#5
Thread Starter
Addicted Member
Re: Save Treeview content into Text file
 Originally Posted by jdc2000
I'm getting "Banned IP Address", can't load the actual page.
-
Apr 4th, 2023, 03:08 PM
#6
Re: Save Treeview content into Text file
Link:
Code:
https://www.fortypoundhead.com/showcontent.asp?artid=48970
It sounds like your IP address is the banned one at that site. Try using a VPN to access it.
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
-
Apr 4th, 2023, 03:52 PM
#7
Thread Starter
Addicted Member
Re: Save Treeview content into Text file
 Originally Posted by jdc2000
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
-
Apr 4th, 2023, 03:58 PM
#8
Re: Save Treeview content into Text file
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
-
Apr 4th, 2023, 04:15 PM
#9
Thread Starter
Addicted Member
Re: Save Treeview content into Text file
Thank you so much! <3
-
Apr 4th, 2023, 04:28 PM
#10
Re: [SOLVED] Save Treeview content into Text file
-
Apr 4th, 2023, 05:00 PM
#11
Thread Starter
Addicted Member
Re: [SOLVED] Save Treeview content into Text file
 Originally Posted by dz32
Just viewed it, it's great, but to much for my need, thank you!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|