Using VBA to create Par files in FactoryTalk

Is the problem already solved? Because I have the same problem... When I create a Test-Application comes the error "The syntax in the line #1=Test is incorrect"
Also you said compiling runtime.

ME and SE are different beasts. SE doesn't compile so automated creation of PAR files is possible, because SE doesn't require the file to exist when it loads only when a loaded display calls for a parameter file. It simply looks in the \PAR directory for a file with the given name.

ME compiles all the resources into a Windows CE executable so Dynamic PAR file creation isn't as straightforward. The methods I used in my examples will still create a valid PAR file that ME can use, but it would be of little use since you'd need to create the files first and then compile.
 
The example code in my post above works provided the tag referenced is defined in the tag database or points to a fully qualified PLC direct tag reference.

Also just to be clear, If you are not automating the creation of Parameter files with VBA then of course the syntax would be incorrect as Parameter files will not work if there are Quotes around the substitution lines. VBA prints what's inside the quotes into a file. If you are just creating Parameter files manually then you would only need;

#1=TEST_TAG

But TEST_TAG would still need to be defined in the Tag Database unless you use a fully qualified Direct Tag Reference.

Sorry, but I don't understand...

So I have a starter question.
Is it possible to create automatic Parameter-Files with vba?
The parameter file includes "direct-tags to plc" (for example [PLC1]Program.Test1) and a "text-string" (description for tag "Test1").


Is it necessary to different between the to cases?

How does the vba-syntax look for both "parameter"?

I hope you unterstand what I mean.
 
Sorry, but I don't understand...

So I have a starter question.
Is it possible to create automatic Parameter-Files with vba?
The parameter file includes "direct-tags to plc" (for example [PLC1]Program.Test1) and a "text-string" (description for tag "Test1").


Is it necessary to different between the to cases?

How does the vba-syntax look for both "parameter"?

I hope you unterstand what I mean.

Yes, you can automate the creation of Parameter files with VBA. However, When you say 'create automatic parameter files' it implies that you want to create the files at Runtime (while the application is actually running). You cannot do this with Machine Edition because all the files must be present when you compile the application. You can do this with Site Edition though because the application does not require compilation. However, if you had a large number of files to create you could still create the files automatically in VBA or any programming language and compile them into your ME application.

Parameter files can use either Defined Tags or Direct Tags or a mixture of the two. The only difference is in the syntax of the substitution.

#50=Test_Tag will look in the Tag Database, if it doesn't find it there it will generate an error on the display that uses #50.

Direct PLC tag references have a specific syntax. I don't remember off hand exactly because I RARELY use direct references. But if memory serves you have to put two colons in front

#1=::[PLC]MainProgram.SOME_TAG

The VBA Syntax that I used in my earlier post is correct and does work. Download the zip file attached to the post and add those displays to a Site Edition project to see how they work and modify to suit your needs.
 
Yes, you can automate the creation of Parameter files with VBA. However, When you say 'create automatic parameter files' it implies that you want to create the files at Runtime (while the application is actually running). You cannot do this with Machine Edition because all the files must be present when you compile the application. You can do this with Site Edition though because the application does not require compilation. However, if you had a large number of files to create you could still create the files automatically in VBA or any programming language and compile them into your ME application.

Parameter files can use either Defined Tags or Direct Tags or a mixture of the two. The only difference is in the syntax of the substitution.

#50=Test_Tag will look in the Tag Database, if it doesn't find it there it will generate an error on the display that uses #50.

Direct PLC tag references have a specific syntax. I don't remember off hand exactly because I RARELY use direct references. But if memory serves you have to put two colons in front

#1=::[PLC]MainProgram.SOME_TAG

The VBA Syntax that I used in my earlier post is correct and does work. Download the zip file attached to the post and add those displays to a Site Edition project to see how they work and modify to suit your needs.

Ok thanks for precise declaration. In my case I have the Machine Edition.

I think that the automation will bring little gain. Because I have a very large number of tags which should be included in the Database. And I think it is not possible to create the tags for the Database automatically. (Maybe withe VBA...)
 
Ok thanks for precise declaration. In my case I have the Machine Edition.

I think that the automation will bring little gain. Because I have a very large number of tags which should be included in the Database. And I think it is not possible to create the tags for the Database automatically. (Maybe withe VBA...)

Ok I have found a wag to import the Tags into the Hmi-Database.
 

Similar Topics

Hi, Can someone guide me through how to use FactoryTalk SE VB script to open communication with SQL Server? which command I can use? Are there...
Replies
2
Views
2,306
Hello Every one, I need a help on vba code for getting data from MSSQL server 2014 to display in FTview SE client version 12 . Thanks. Please...
Replies
4
Views
1,815
Hi, how can i use a defined Tag in HMI Tags (for exampele dintTag ) in VBA code by a display. i am using FactoryTalk SE thanx
Replies
1
Views
2,231
I am trying to open a single display for multiple messages. I understand that I can use parameters to load different messages etc but would like...
Replies
0
Views
1,227
Hello, I am looking for help writing to PLC tags from Excel. I am using Factory Talk Gateway as an OPC server and Excel VBA to write out to an...
Replies
5
Views
3,106
Back
Top Bottom