Quantcast
Channel: OSIsoft Users Community
Viewing all articles
Browse latest Browse all 1120

SendKeys "{ENTER}"

$
0
0

Hello:

 

Im trying to run a macro in an Excel WorkBook from PI Processbock and SendKeys "{ENTER}" do not run the macro( CommandButton):

Example:

 

Set XLApp = CreateObject("Excel.Application")
XLApp.Visible = True
 
XLApp.RegisterXLL ("C:\Program Files\PIPC\Excel\pipc32.xll")
Set XLWkbk = XLApp.Workbooks.Open(XlsArch)
Dim xlWS As Excel.Worksheet
 
Dim obj As OLEObject
    For Each xlWS In XLWkbk.Worksheets
        If xlWS.Name = "REPORTE LR1" Then 
            xlWS.Activate
            On Error GoTo L00
             xlWS.OLEObjects("Get_Values").Object.Activate' Activate the commandButton
             SendKeys "{ENTER}", True' This Should make rund the macro in commandButton, but nothing happens
            ActiveWorkbook.Saved = True
       End If
    Next xlWS
 
XLWkbk.Worksheets(1).Calculate
 
 

L00:

 

XLWkbk.Close False
XLApp.Quit
 
Set XLWkbk = Nothing
Set XLApp = Nothing
 
 
Any Idea?
 
Thanks in advace.
 

Viewing all articles
Browse latest Browse all 1120

Trending Articles