hi there i have a cell [11] which contains "admingroup,update,viewonly" and it is a variable length. So one user can be in different user groups. i'm using an array to split the cell, however i'm only getting the first data (admingroup). here is the code i'm using. thank you in advance

Private Sub CommandButton1_Click()

Dim participant, password, userName, companyName, email, DTime As String
Dim plantList As String
Dim userGroup As String
Dim myString As String
Dim myArray As Variant
Dim irow, icol As Integer
Dim ifh As Long

DTime = CStr(Now())
DTime = Replace(DTime, "/", "-", 1, -1, vbTextCompare)
DTime = Replace(DTime, ":", "-", 1, -1, vbTextCompare)
DTime = Replace(DTime, " ", "-", 1, -1, vbTextCompare)

ifh = FreeFile
FileName = ActiveWorkbook.Path & "\Current_Export Users" & DTime & ".txt"
Open FileName For Output As ifh

irow = 3
With ActiveSheet
On Error Resume Next
While .Cells(irow, 1) <> ""

myString = .Cells(irow, 11)
myArray = Split(myString, ",")

icol = 1
While .Cells(2, icol) <> ""

' Users

userGroup = myArray(0)

participant = .Cells(irow, 1)
password = .Cells(irow, 2)
userName = .Cells(irow, 3)
email = .Cells(irow, 4)

Print #ifh, "----------------------"
Print #ifh, "User Group "
Print #ifh, "----------------------"
Print #ifh, "." & userGroup
Print #ifh, "..UserGroupName|" & userGroup
Print #ifh, "..UserGroupDesc|"
Print #ifh, "----------------------"
Print #ifh, "Export Users"
Print #ifh, "----------------------"
Print #ifh, ""
Print #ifh, ".Usr"
Print #ifh, "..Participant|" & participant
Print #ifh, "..Password|" & password
Print #ifh, "..UserName|" & userName
Print #ifh, "..CompanyName|"
Print #ifh, "..Email|" & email
Print #ifh, "-------- END-----------"

icol = icol + 1
Wend
irow = irow + 1
Wend
End With
Close ifh
End Sub

Would It be possible to attach the project as a .zip file, with any needed files?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.