ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Err 13 Cant find problem (https://www.excelbanter.com/excel-programming/401226-err-13-cant-find-problem.html)

Arne Hegefors

Err 13 Cant find problem
 
Hi! I have a loop that sometimes opens o workbook. when the loop is finished
I want to close that worksbook, if it is open. However I get Err 13 when
trying to close the workbook (which is not a problem here but I becaomes a
problem later so I must solve this). I have checked all the spelling and the
paths to the file but I simply cannot see the probelm. Please help me solve
this.

'here is the file that I open sometimes
Dim strOptionFile As String
Dim strFXOptionPath As String
Dim strRMFXOptionSheet As String
strFXOptionPath = "X:\SCD_RiskManager_Pos\fxOptions\FXOptionFile.xls "
strRMFXOptionSheet = "RM"

''later in the code I check if the workbook is open
If WorkbookIsOpen(strOptionFile) = True Then
Workbooks(strOptionFile).Close
End If

Nigel[_2_]

Err 13 Cant find problem
 
Where is your function WorkbookIsOpen ? This is not a standard Excel
function.

Post the code.

--

Regards,
Nigel




"Arne Hegefors" wrote in message
...
Hi! I have a loop that sometimes opens o workbook. when the loop is
finished
I want to close that worksbook, if it is open. However I get Err 13 when
trying to close the workbook (which is not a problem here but I becaomes a
problem later so I must solve this). I have checked all the spelling and
the
paths to the file but I simply cannot see the probelm. Please help me
solve
this.

'here is the file that I open sometimes
Dim strOptionFile As String
Dim strFXOptionPath As String
Dim strRMFXOptionSheet As String
strFXOptionPath = "X:\SCD_RiskManager_Pos\fxOptions\FXOptionFile.xls "
strRMFXOptionSheet = "RM"

''later in the code I check if the workbook is open
If WorkbookIsOpen(strOptionFile) = True Then
Workbooks(strOptionFile).Close
End If




All times are GMT +1. The time now is 12:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com