'Username and Password in VBS script to be used in VBA
How can I pull my username and password from a vbs script and input that into my vba code. I manually input my username and password into the below, however I am worried others may find my login credentials.
VBA code:
Public Property Let jiraUSER(Value As String): pjiraUSER = "username"
End Property
Public Property Let jiraPW(Value As String): pjiraPW = "password"
End Property
VBS:
'Input Excel File's Full Path
ExcelFilePath = "O:\Export.xlsm"
'Input Module/Macro name within the Excel File
MacroPath = "JIRARestAPIEngine.scriptGO"
'Create an instance of Excel
Set ExcelApp = CreateObject("Excel.Application")
'Do you want this Excel instance to be visible?
ExcelApp.Visible = True 'or "False"
'Prevent any App Launch Alerts (ie Update External Links)
ExcelApp.DisplayAlerts = False
'Open Excel File
Set wb = ExcelApp.Workbooks.Open(ExcelFilePath)
'Execute Macro Code
ExcelApp.Run MacroPath
'Save Excel File (if applicable)
wb.Save
'Reset Display Alerts Before Closing
ExcelApp.DisplayAlerts = True
'Close Excel File
wb.Close
'End instance of Excel
ExcelApp.Quit
'Leaves an onscreen message!
MsgBox "Your Automated Task successfully ran at " & TimeValue(Now), vbInformation
Thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
