Consulting

Results 1 to 2 of 2

Thread: Shared excel userform

  1. #1

    Smile Shared excel userform

    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

  2. #2
    Solved by changing path to file

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •