Ik heb onderstaande module.
Sub setResults()
Dim cDirectory As String
Dim cFileName As String
Dim cCurrentWorkbook As String
cCurrentWorkbook = ActiveWorkbook.Name
cDirectory = ThisWorkbook.Path
cFileName = "MyFile"
Workbooks.Open Filename:=cDirectory + "" + cFileName
x = Workbooks(cFileName).Sheets(1).UsedRange
Workbooks(cCurrentWorkbook).Activate
nLastLine = UBound(x)
For nRow = 2 To nLastLine
putSaldo (nRow)
Next
End Sub
De module wordt aangeroepen als macro.
Als MyFile niet open is wordt het statement na Workbooks.Openfile niet meer uitgevoerd.
Dit heb ik gecontroleerd door een breakpoint op de volgende instructie te zetten.
Als MyFile wel open is werkt de applicatie correct.
Weet iemand hoe dit komt en wat ik er aan kan doen?
Sub setResults()
Dim cDirectory As String
Dim cFileName As String
Dim cCurrentWorkbook As String
cCurrentWorkbook = ActiveWorkbook.Name
cDirectory = ThisWorkbook.Path
cFileName = "MyFile"
Workbooks.Open Filename:=cDirectory + "" + cFileName
x = Workbooks(cFileName).Sheets(1).UsedRange
Workbooks(cCurrentWorkbook).Activate
nLastLine = UBound(x)
For nRow = 2 To nLastLine
putSaldo (nRow)
Next
End Sub
De module wordt aangeroepen als macro.
Als MyFile niet open is wordt het statement na Workbooks.Openfile niet meer uitgevoerd.
Dit heb ik gecontroleerd door een breakpoint op de volgende instructie te zetten.
Als MyFile wel open is werkt de applicatie correct.
Weet iemand hoe dit komt en wat ik er aan kan doen?