Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Command Button VBA UpdatePSData.bat & UpdatePSDataIntraday.bat

Command Button VBA UpdatePSData.bat & UpdatePSDataIntraday.bat
For those who wish to select a command button in Portfolio Slicer in order to run UpdatePSData.bat or UpdatePSDataIntraday.bat

Code For UpdatePSData.bat:
Private Sub CommandButton1_Click()
Dim NewPath As String: NewPath = "C:\ENTER YOUR PATH\PortfolioSlicer\"

ChDir NewPath

Call Shell(Environ$("COMSPEC") & " /c " & "C:\ENTER YOUR PATH\PortfolioSlicer\" & "\UpdatePSData.bat", vbReadOnly)
End Sub


Code For UpdatePSDataIntraday.bat:
Private Sub CommandButton2_Click()
Dim NewPath As String: NewPath = "C:\ENTER YOUR PATH\PortfolioSlicer\"

ChDir NewPath

Call Shell(Environ$("COMSPEC") & " /c " & "C:\ENTER YOUR PATH\PortfolioSlicer\" & "\UpdatePSDataIntraday.bat", vbReadOnly)
End Sub

Comments

  • edited April 2016
    Hi royoung,

    Thank you, this is great idea - add button to Excel workbook that will refresh Portfolio Slicer external data file. For anyone that wants to do so, most likely you first need to enable "Developer" tab as per instructions here (https://msdn.microsoft.com/en-us/library/office/ee814737(v=office.14).aspx)

    1. On the File tab, choose Options to open the Excel Options dialog box.
    2. Click Customize Ribbon on the left side of the dialog box.
    3. Under Choose commands from on the left side of the dialog box, select Popular Commands.
    4. Under Customize the ribbon on the right side of the dialog box, select Main tabs, and then select the Developer check box.
    5. Click OK.

    Then from "Developer" tab you select "Insert", choose button and create button with code from above.

    Again, great idea, thanks royoung!
  • Keep up the great work VidasMatelis!
Sign In or Register to comment.