0% found this document useful (0 votes)
8 views1 page

New Text Document

Uploaded by

service
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

New Text Document

Uploaded by

service
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Sub VBFunction_1()

'Tip:
' 1. Use the <CTRL+SPACE> or <CTRL+I> shortcut to open a list of all objects
and functions
' 2. Write the code using the HMI Runtime object.
' Example: [Link]("Screen_1").
' 3. Use the <CTRL+J> shortcut to create an object reference.

'Write the code as of this position:


Dim excel 'Declare excel internal variable
Set excel = CreateObject("[Link]")
[Link] = False
[Link] "D:\Excel_Report"

'Find the last used row in Sheet1


Dim lastRow As Long
lastRow = [Link]("Sheet1").[Link](11).Row

'Write data to the next available row


[Link]("Sheet1").Cells(lastRow + 1, 1).Value = Date
[Link]("Sheet1").Cells(lastRow + 1, 2).Value = Time
[Link]("Sheet1").Cells(lastRow + 1, 3).Value =
SmartTags("DATA1").Value
[Link]("Sheet1").Cells(lastRow + 1, 4).Value =
SmartTags("DATA2").Value
[Link]("Sheet1").Cells(lastRow + 1, 5).Value =
SmartTags("DATA3").Value
[Link]("Sheet1").Cells(lastRow + 1, 6).Value =
SmartTags("DATA4").Value
[Link]("Sheet1").Cells(lastRow + 1, 7).Value =
SmartTags("DATA5").Value

[Link]
[Link]
[Link]
End Sub

You might also like