File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,17 @@ Public Sub importNamedRanges(wb As Workbook)
22
22
23
23
Dim fileName As String
24
24
fileName = importDir & NAMED_RANGES_FILE_NAME
25
-
26
25
Dim fso As New Scripting.FileSystemObject
27
- Dim inStream As TextStream
28
- Set inStream = fso.OpenTextFile(fileName, ForReading, Create:=False )
29
- Dim line As String
30
- Do Until inStream.AtEndOfStream
31
- line = inStream.ReadLine
32
- importName wb, line
33
- Loop
26
+ If fso.FileExists(fileName) Then
27
+ Dim inStream As TextStream
28
+ Set inStream = fso.OpenTextFile(fileName, ForReading, Create:=False )
29
+ Dim line As String
30
+ Do Until inStream.AtEndOfStream
31
+ line = inStream.ReadLine
32
+ importName wb, line
33
+ Loop
34
+ inStream.Close
35
+ End If
34
36
End Sub
35
37
36
38
Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ End Sub
16
16
Private Sub Workbook_BeforeClose (Cancel As Boolean )
17
17
Debug.Print "vbaDeveloper thisWorkbook_BeforeClose()"
18
18
menu.deleteMenu
19
- customAction.beforeClose
20
- Set customAction = Nothing
19
+ If Not customAction Is Nothing Then
20
+ customAction.beforeClose
21
+ Set customAction = Nothing
22
+ End If
21
23
Set listener = Nothing
22
24
End Sub
You can’t perform that action at this time.
0 commit comments