Vous êtes sur la page 1sur 3

1.

Installation
Copy FHLogixLib.dll into Windows\System32 or Windows\SysWow64 depending on type of
windows.
From the same folder run regsvr32 FHLogix.dll

2. Usage in Excel VBA


In VB editor, point reference to the Class Library for L5K file

3. Example
Sub DemoAddTag()
'demonstrate how to add a Bool tag into controller
Dim aNewTag As LogixTag
Dim aCtrl As New LogixController
strFileToOpen = Application.GetOpenFilename(Title:="Open RSLogix L5K Export File",
FileFilter:="L5K Files *.L5K* (*.L5K*),")
If Len(strFileToOpen) > 0 Then
Dim aCtrl As New LogixController
aCtrl.LoadConfigFile strFileToOpen 'load L5K to memory
'create a new tag:
Set aNewTag = New LogixTag
With aNewTag
.Name = "MYNEWTAG0001"
.DataType = "BOOL"
.Description = "My test tag" & vbCrLf & "Demonstrate use of dll"
End With
'now add this to controller
aCtrl.Tags.Add aNewTag
'save the config into a different file
strFileToOpen = Left(strFileToOpen, Len(strFileToOpen) - 4) & "_DEMO.L5K"
aCtrl.SaveConfigFile strFileToOpen

End If
End Sub

Result from running the above code:

This is the structure of aCtrl when debugged:

4. Possible uses:
Creating routine from a template
Creating tags
Creating UDT
Merging two different projects
Adding a lot of tag comments
Adding rung in routine based on templates
etc

Vous aimerez peut-être aussi