maxkoy
11-30-2009, 06:22 AM
Hi all,
I have a code where i need to open a other workbook. I works fine with .xls files, but when im trying to open a .xlsm file i just get a error? Anyone knows why?
Private Sub CommandButton1_Click()
Dim i As Integer
Dim pw As String
Dim path As String
Dim clor As String
Application.ScreenUpdating = False
With ListBox1
For i = 0 To .ListCount - 1
If .ListIndex = i Then pw = Range("B" & i + 4).Value
If .ListIndex = i Then path = Range("G" & i + 4).Value
If .ListIndex = i Then clor = Range("I" & i + 4).Select
Next i
End With
'ERROR COMES HERE!
Application.Workbooks.Open Filename:=path
I have a code where i need to open a other workbook. I works fine with .xls files, but when im trying to open a .xlsm file i just get a error? Anyone knows why?
Private Sub CommandButton1_Click()
Dim i As Integer
Dim pw As String
Dim path As String
Dim clor As String
Application.ScreenUpdating = False
With ListBox1
For i = 0 To .ListCount - 1
If .ListIndex = i Then pw = Range("B" & i + 4).Value
If .ListIndex = i Then path = Range("G" & i + 4).Value
If .ListIndex = i Then clor = Range("I" & i + 4).Select
Next i
End With
'ERROR COMES HERE!
Application.Workbooks.Open Filename:=path