PDA

View Full Version : [SOLVED] Shared excel userform



loop66
04-11-2019, 02:57 AM
excel file works fine on local pc , problem is when i open it from another computer

userform freezes on bolded part



Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim intDialogResult As Integer
Dim strPath As String
Dim strLine As String
Dim arrString() As String
Dim i As Integer
Dim lbtarget As MSForms.ListBox
Dim rngSource As Range

Sheets("Sheet1").Activate
strPath = "C:\xampp\htdocs\ABC\BCA.txt"
Open strPath For Input As #1
i = 1
While EOF(1) = False
Line Input #1, strLine
arrString = Split(strLine, ",")
Cells(i, 1) = arrString(0)
Cells(i, 2) = arrString(1)
Cells(i, 3) = arrString(2)
Cells(i, 4) = arrString(3)
Cells(i, 5) = arrString(4)
Cells(i, 6) = arrString(5)
Cells(i, 7) = arrString(6)
Cells(i, 8) = arrString(7)
Cells(i, 9) = arrString(8)
i = i + 1
Wend
Close #1


Set rngSource = Worksheets("Sheet1").Range("A:I")
Set lbtarget = Me.ListBox1
With lbtarget
.ColumnCount = 50
.ColumnWidths = "50;120;80;60;60;60;200;60"
.List = rngSource.Cells.Value
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub

loop66
04-11-2019, 03:35 AM
Solved by changing path to file

strPath = ActiveWorkbook.Path & "\BCA.txt"