Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
With Worksheets("Cert_Path_module")
For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
Set nodX = .Add( etc.
Nodes have to be added to a Treeview and I didn't see that in your code. RBS "Ram" wrote in message ups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
On Apr 3, 12:01 pm, "RB Smissaert"
wrote: Set nodX = .Add( etc. Nodes have to be added to a Treeview and I didn't see that in your code. RBS "Ram" wrote in message ups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method.- Hide quoted text - - Show quoted text - The complete code is as follows Private Sub UserForm_Initialize() Dim i As Integer Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Range("Pr" & i).Values < "" Then Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) End If End With Next End With nodX.Expanded = True nodX.Expanded = True nodX.EnsureVisible End Sub but i get error Run-time error '438': Object doesn't support this property or method, when the system tries to excute this line Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) Where am i going wrong?? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
Check your "With" blocks.
It looks like "Set nodX = .Add("GP", ... is referring to Worksheets("tv").Range("Pr" & i) You cannot nest 2 unrelated object hierarchies. NickHK "Ram" wrote in message oups.com... On Apr 3, 12:01 pm, "RB Smissaert" wrote: Set nodX = .Add( etc. Nodes have to be added to a Treeview and I didn't see that in your code. RBS "Ram" wrote in message ups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method.- Hide quoted text - - Show quoted text - The complete code is as follows Private Sub UserForm_Initialize() Dim i As Integer Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Range("Pr" & i).Values < "" Then Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) End If End With Next End With nodX.Expanded = True nodX.Expanded = True nodX.EnsureVisible End Sub but i get error Run-time error '438': Object doesn't support this property or method, when the system tries to excute this line Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) Where am i going wrong?? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
On Apr 3, 12:22 pm, "NickHK" wrote:
Check your "With" blocks. It looks like "Set nodX = .Add("GP", ... is referring to Worksheets("tv").Range("Pr" & i) You cannot nest 2 unrelated object hierarchies. NickHK "Ram" wrote in message oups.com... On Apr 3, 12:01 pm, "RB Smissaert" wrote: Set nodX = .Add( etc. Nodes have to be added to a Treeview and I didn't see that in your code. RBS "Ram" wrote in message oups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method.- Hide quoted text - - Show quoted text - The complete code is as follows Private Sub UserForm_Initialize() Dim i As Integer Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Range("Pr" & i).Values < "" Then Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) End If End With Next End With nodX.Expanded = True nodX.Expanded = True nodX.EnsureVisible End Sub but i get error Run-time error '438': Object doesn't support this property or method, when the system tries to excute this line Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) Where am i going wrong??- Hide quoted text - - Show quoted text - The reason i'm refering is because i want the node to get its value from Pr1 so on till Pr5 so what can i set my node to? Any suggestions? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
On Apr 3, 12:22 pm, "NickHK" wrote:
Check your "With" blocks. It looks like "Set nodX = .Add("GP", ... is referring to Worksheets("tv").Range("Pr" & i) You cannot nest 2 unrelated object hierarchies. NickHK "Ram" wrote in message oups.com... On Apr 3, 12:01 pm, "RB Smissaert" wrote: Set nodX = .Add( etc. Nodes have to be added to a Treeview and I didn't see that in your code. RBS "Ram" wrote in message oups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method.- Hide quoted text - - Show quoted text - The complete code is as follows Private Sub UserForm_Initialize() Dim i As Integer Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Range("Pr" & i).Values < "" Then Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) End If End With Next End With nodX.Expanded = True nodX.Expanded = True nodX.EnsureVisible End Sub but i get error Run-time error '438': Object doesn't support this property or method, when the system tries to excute this line Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) Where am i going wrong??- Hide quoted text - - Show quoted text - My excel sheet has 1- Grand Parent 5- Parents and 100 kids (each Parent having 20 kids each) now i can write a huge code to get values from the sheet and Populate the node, but the problem i face if there are Empty cells i.e. if in the excel sheet on 2 parents fields are filled and only 10 kids fields are filled. I get an empty node whereever empty cells. this make the treeview look absurd. I got a reply from one of the group members to use an if condition. And i used it (the above code) which throws an error. Any suggestions? |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
As I said you have to fix your With blocks.
And there is no such property as .Values as in: ..Range("Pr" & i).Values maybe something like: With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) End With With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Value < "" Then Set nodX = TreeView1.Nodes.Add("GP", tvwChild, "Parent1", ..Value) End If End With Next End With NickHK "Ram" wrote in message oups.com... On Apr 3, 12:22 pm, "NickHK" wrote: Check your "With" blocks. It looks like "Set nodX = .Add("GP", ... is referring to Worksheets("tv").Range("Pr" & i) You cannot nest 2 unrelated object hierarchies. NickHK "Ram" wrote in message oups.com... On Apr 3, 12:01 pm, "RB Smissaert" wrote: Set nodX = .Add( etc. Nodes have to be added to a Treeview and I didn't see that in your code. RBS "Ram" wrote in message oups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method.- Hide quoted text - - Show quoted text - The complete code is as follows Private Sub UserForm_Initialize() Dim i As Integer Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Range("Pr" & i).Values < "" Then Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) End If End With Next End With nodX.Expanded = True nodX.Expanded = True nodX.EnsureVisible End Sub but i get error Run-time error '438': Object doesn't support this property or method, when the system tries to excute this line Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) Where am i going wrong??- Hide quoted text - - Show quoted text - The reason i'm refering is because i want the node to get its value from Pr1 so on till Pr5 so what can i set my node to? Any suggestions? |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
On Apr 3, 1:09 pm, "NickHK" wrote:
As I said you have to fix your With blocks. And there is no such property as .Values as in: .Range("Pr" & i).Values maybe something like: With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) End With With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Value < "" Then Set nodX = TreeView1.Nodes.Add("GP", tvwChild, "Parent1", .Value) End If End With Next End With NickHK "Ram" wrote in message oups.com... On Apr 3, 12:22 pm, "NickHK" wrote: Check your "With" blocks. It looks like "Set nodX = .Add("GP", ... is referring to Worksheets("tv").Range("Pr" & i) You cannot nest 2 unrelated object hierarchies. NickHK "Ram" wrote in message roups.com... On Apr 3, 12:01 pm, "RB Smissaert" wrote: Set nodX = .Add( etc. Nodes have to be added to a Treeview and I didn't see that in your code. RBS "Ram" wrote in message oups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method.- Hide quoted text - - Show quoted text - The complete code is as follows Private Sub UserForm_Initialize() Dim i As Integer Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Range("Pr" & i).Values < "" Then Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) End If End With Next End With nodX.Expanded = True nodX.Expanded = True nodX.EnsureVisible End Sub but i get error Run-time error '438': Object doesn't support this property or method, when the system tries to excute this line Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) Where am i going wrong??- Hide quoted text - - Show quoted text - The reason i'm refering is because i want the node to get its value from Pr1 so on till Pr5 so what can i set my node to? Any suggestions?- Hide quoted text - - Show quoted text - Sorry for coming back i'm totally new to this code. I made changes that you had suggested, but no success. I really dumb with this code. Dim i As Long Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) End With With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Value < "" Then Set nodX = TreeView1.Nodes.Add("GP", tvwChild, "Parent1", .Value) End If End With Next End With this is how my code looks now but i get the same error. |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
On Apr 3, 2:28 pm, "Ram" wrote:
On Apr 3, 1:09 pm, "NickHK" wrote: As I said you have to fix your With blocks. And there is no such property as .Values as in: .Range("Pr" & i).Values maybe something like: With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) End With With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Value < "" Then Set nodX = TreeView1.Nodes.Add("GP", tvwChild, "Parent1", .Value) End If End With Next End With NickHK "Ram" wrote in message roups.com... On Apr 3, 12:22 pm, "NickHK" wrote: Check your "With" blocks. It looks like "Set nodX = .Add("GP", ... is referring to Worksheets("tv").Range("Pr" & i) You cannot nest 2 unrelated object hierarchies. NickHK "Ram" wrote in message roups.com... On Apr 3, 12:01 pm, "RB Smissaert" wrote: Set nodX = .Add( etc. Nodes have to be added to a Treeview and I didn't see that in your code. RBS "Ram" wrote in message oups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I get error Run-time error '438': Object doesn't support this property or method.- Hide quoted text - - Show quoted text - The complete code is as follows Private Sub UserForm_Initialize() Dim i As Integer Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Range("Pr" & i).Values < "" Then Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) End If End With Next End With nodX.Expanded = True nodX.Expanded = True nodX.EnsureVisible End Sub but i get error Run-time error '438': Object doesn't support this property or method, when the system tries to excute this line Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) Where am i going wrong??- Hide quoted text - - Show quoted text - The reason i'm refering is because i want the node to get its value from Pr1 so on till Pr5 so what can i set my node to? Any suggestions?- Hide quoted text - - Show quoted text - Sorry for coming back i'm totally new to this code. I made changes that you had suggested, but no success. I really dumb with this code. Dim i As Long Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) End With With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Value < "" Then Set nodX = TreeView1.Nodes.Add("GP", tvwChild, "Parent1", .Value) End If End With Next End With this is how my code looks now but i get the same error.- Hide quoted text - - Show quoted text - I did little modifications and the problem is fixed now. Thanks a lot for your help NickHK |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Treeview error please help (SC)
On Apr 3, 2:30 pm, "Ram" wrote:
On Apr 3, 2:28 pm, "Ram" wrote: On Apr 3, 1:09 pm, "NickHK" wrote: As I said you have to fix your With blocks. And there is no such property as .Values as in: .Range("Pr" & i).Values maybe something like: With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) End With With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Value < "" Then Set nodX = TreeView1.Nodes.Add("GP", tvwChild, "Parent1", .Value) End If End With Next End With NickHK "Ram" wrote in message roups.com... On Apr 3, 12:22 pm, "NickHK" wrote: Check your "With" blocks. It looks like "Set nodX = .Add("GP", ... is referring to Worksheets("tv").Range("Pr" & i) You cannot nest 2 unrelated object hierarchies. NickHK "Ram" wrote in message roups.com... On Apr 3, 12:01 pm, "RB Smissaert" wrote: Set nodX = .Add( etc. Nodes have to be added to aTreeviewand I didn't see that in your code. RBS "Ram" wrote in message oups.com... With Worksheets("Cert_Path_module") For i = 1 To 5 With .Range("Module_" & i) If .Range("Module_" & i).Values < "" Then Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) End If End With Next i End With But when the system executes Set nodX = .Add("Path", tvwChild, "Mod", Worksheets("Cert_Path_module").Range("Module_" & i).Value) I geterror Run-timeerror'438': Object doesn't support this property or method.- Hide quoted text - - Show quoted text - The complete code is as follows Private Sub UserForm_Initialize() Dim i As Integer Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Range("Pr" & i).Values < "" Then Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) End If End With Next End With nodX.Expanded = True nodX.Expanded = True nodX.EnsureVisible End Sub but i geterrorRun-timeerror'438': Object doesn't support this property or method, when the system tries to excute this line Set nodX = .Add("GP", tvwChild, "Parent1", Worksheets("tv").Range("Pr" & i).Value) Where am i going wrong??- Hide quoted text - - Show quoted text - The reason i'm refering is because i want the node to get its value from Pr1 so on till Pr5 so what can i set my node to? Any suggestions?- Hide quoted text - - Show quoted text - Sorry for coming back i'm totally new to this code. I made changes that you had suggested, but no success. I really dumb with this code. Dim i As Long Dim nodX As Node With TreeView1.Nodes .Clear Set nodX = .Add(, , "GP", Worksheets("tv").Range("GP").Value) End With With Worksheets("tv") For i = 1 To 5 With .Range("Pr" & i) If .Value < "" Then Set nodX = TreeView1.Nodes.Add("GP", tvwChild, "Parent1", .Value) End If End With Next End With this is how my code looks now but i get the sameerror.- Hide quoted text - - Show quoted text - I did little modifications and the problem is fixed now. Thanks a lot for yourhelpNickHK- Hide quoted text - - Show quoted text - Now I have a different error with treeview . Now as the above code take in values of the cells thats been given, now if the Parent Nodes cell is blank thought it has no chlidren, it thorws an error "Element not found". What modification do i make to get rid of this?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
TreeView | Excel Programming | |||
TreeView Help | Excel Programming | |||
Treeview | Excel Programming | |||
How to Treeview in VBA | Excel Programming | |||
Treeview | Excel Programming |