|
-
Nov 16th, 2005, 09:51 PM
#1
Thread Starter
Addicted Member
Array a cell
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
Last edited by Prav; Nov 17th, 2005 at 01:08 AM.
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
|