File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -454,14 +454,20 @@ Public Sub ClearSettings()
454
454
End Sub
455
455
456
456
457
- Public Function GetReadAPIKeyFromFolder (ByVal strfolderPath As String ) As String
457
+ Public Function GetReadAPIKeyFromFolder (ByVal strfolderPath As String , Optional ByVal strDefaultTextFileName As String = "apikey" ) As String
458
458
'Purpose: Allows retrieval of an API KEY saved in an external file (possibly stored on a drive only the current user can access)
459
459
460
460
Dim intFileNumber As Integer
461
461
Dim strAPIKey As String
462
462
Dim strFilePath As String
463
463
464
- strFilePath = strfolderPath & "\apikey.txt" ' Construct the full file path
464
+ strFilePath = strfolderPath & "\" & strDefaultTextFileName & ".txt" ' Construct the full file path
465
+
466
+ 'check file exists
467
+ If Dir(strFilePath) = "" Then
468
+ GetReadAPIKeyFromFolder = Empty
469
+ Exit Function
470
+ End If
465
471
466
472
intFileNumber = FreeFile ' Get the first available file number
467
473
You can’t perform that action at this time.
0 commit comments