Why is this not working? Im working in Excel 2003.
I thought I could set it to a different listbox depending on the value of my page variable?
Do I need to somehow set my dynamic variable as a listbox control?
I thought I could set it to a different listbox depending on the value of my page variable?
Do I need to somehow set my dynamic variable as a listbox control?
Code:
Dim logfilepath As String
Dim dynamicbox As String
Select Case page
Case Is = 1
dynamicbox = ListBox1
Case Is = 2
dynamicbox = ListBox2
Case Is = 3
dynamicbox = ListBox3
Case Is = 4
dynamicbox = ListBox4
Case Is = 5
dynamicbox = ListBox5
End Select
logfilepath = "k:\handläggningsstöd\Ärenden\logg-för-" & logfilename & ".ini"
If FileOrDirExists(logfilepath) Then
MsgBox ("Det finns en LOGGFIL!")
UserForm1.dynamicbox.Clear
Dim lFile As Long
Dim varjerad As String
lFile = FreeFile()
Open logfilepath For Input As lFile
While Not EOF(lFile)
Line Input #lFile, varjerad
UserForm1.dynamicbox.AddItem varjerad
Wend
Close lFile
Else
MsgBox ("DET FINNS ABSOLUT INGEN LOGG FIL")
End If