2/24/2015 11:28 AM | |
Posts: 107 Rating: (0) |
Hello specs. can anyone tell me how can I change from Sub OnClick(ByVal Item) to Action on trigger event maybe I have to change Sub to action or function etc. the example of a script is this: Sub OnClick(ByVal Item) Dim sDsn, sCon, sSql Dim conn, oRs, oCom Dim m, DSNName,ServerName, sServerName
Dim objControl Dim sBeginTime, sEndTime Dim sGMTime,sLocalTime Dim TimeCorrection Dim sFileName Dim sTagName
Dim i,j,R,C,Diff Dim bVisible Dim bTimeCollumn
Dim OldLocale Dim Ans OldLocale = GetLocale () If (OldLocale = 1049) Then 'Russian Else Ans = MsgBox("Export works only in local region." & vbCrLf & "Change to Russian region for export time?", vbYesNo) If (Ans = vbYes) Then SetLocale(1049) Else Exit Sub End If End If
Set DSNName = HMIRuntime.Tags("@DatasourceNameRT") DSNName.Read sDsn = DSNName.Value End If bTimeCollumn = True Else End If Next HMIRuntime.Trace "Control1: stop" & vbCrLf ExcelSheet.ActiveSheet.Cells(1,1).Value = R - 2 ExcelSheet.ActiveSheet.Cells(1,2).Value = C - 2 Set oRs = Nothing Set conn = Nothing ExcelSheet.ActiveSheet.Columns(1).Font.Bold = True ExcelSheet.ActiveSheet.Rows(1).Font.Bold = True ExcelSheet.ActiveSheet.Rows(1).Font.Italic = True ExcelSheet.ActiveSheet.Rows(1).Font.Underline = True ExcelSheet.ActiveSheet.Columns.AutoFit
sFileName = "H:\Documents and Settings\u837process\Ðàáî÷èé ñòîë\report\" & Day(Date)& "." & Month(Date) & "." & Year(Date) & "__" & Hour(Now) & "-" & Minute(Now) & "-" & Second(Now) & ".XLS" ExcelSheet.SaveAs sFileName MsgBox "Îò÷åò ñîõðàíåí â ôàéëå:" & vbCrLf & sFileName ScreenItems("Report").Text = sFileName ExcelSheet.Application.Quit Set ExcelSheet = Nothing objExcelApp.Quit Set objExcelApp = Nothing SetLocale(OldLocale) End Sub thanks in advance IT_Service
-------------- |
Last edited by: Min_Moderator at: 2/24/2015 2:52:31 PMNew subject after splitting |
|
Follow us on