File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -454,14 +454,20 @@ Public Sub ClearSettings()
454454End Sub
455455
456456
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
458458'Purpose: Allows retrieval of an API KEY saved in an external file (possibly stored on a drive only the current user can access)
459459
460460 Dim intFileNumber As Integer
461461 Dim strAPIKey As String
462462 Dim strFilePath As String
463463
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
465471
466472 intFileNumber = FreeFile ' Get the first available file number
467473
You can’t perform that action at this time.
0 commit comments