FactoryTalk Se Tag Value Using VBA

asterof

Member
Join Date
May 2007
Location
Califonia
Posts
554
Creating a file name from a tag.value


Set MyTagGroup = Application.CreateTagGroup(Me.AreaName)

Dim Fname, Dfile As String
Dim NewFile As Tag

MyTagGroup.Add "Recipe\Recipe_FBK_Formulation"

MyTagGroup.Active = True

Set NewFile = MyTagGroup.Item("Recipe\Recipe_FBK_Formulation")

Fname = "C:\Access_DB\Data_Base.xls" 'name of already created excel file
Dfile = "C:\Access_DB\" & NewFile.Value & ".xls" 'name of new excel file

FileCopy Fname, Dfile

End Sub

So Fname already esist on the path
Dfile is suppose to take the value of Recipe\Recipe_FBK_Formulation and plug it into the
new file name.
Instead of the value it seem to be plugin in /::Recipe\Recipe_FBK_Formulation
So what am I doing wrong
 
As no one had an answer lets try another way

using VBA need to get the contents of a string tag
to use in a file open path
Anyone have any examples


Fname = "C:\Access_DB\& tag_string & ".txt"
Tag string is the text in a string tag
 
You should probably use the "RefreshFromSource" method on your tag group before even trying to read the tag. Just setting the group active does not force the tags in it to be on scan immediately.

You can also use RefreshFromSource directly on the tag object.

You can check the tags "DataType" property to make sure it is returning a string. The DataType property should be 8 (tagDataTypeString) for a string.

And, of course, step through with the debugger, and USE ERROR CHECKING!
 
Factory Talk View Site Edition 6.10

Estou com dificuldade de resolver um problema aqui, gostaria de saber quem pode me ajudar.

Tenho que mandar um comando para diversos tags para resetar alguns alarmes.

Com isto gostaria de saber como faco via Script - VBA para dar um set no tag - AT300D.OCmd_Reset via script - Pressionando um botao.

Se eu vou pelas propriedades do botao para localizar o tag ele se encontra aqui:

Pression Action
&Set /Pot_Bio::[Pot_Bio]AT300D.OCmd_Reset 1

Desta forma funciona mas tenho que adicionar muito mais destas linhas e com isto prefiro fazer via script.

Como faco via script para localizar o caminho do meu tag que esta online, para mim dar um set nele?

Se alguem puder me ajudar agradeco.
 
Last edited:
Translated

Factory Talk View Site Edition 6.10

Estou com dificuldade de resolver um problema aqui, gostaria de saber quem pode me ajudar.

Tenho que mandar um comando para diversos tags para resetar alguns alarmes.

Com isto gostaria de saber como faco via Script - VBA para dar um set no tag - AT300D.OCmd_Reset via script - Pressionando um botao.

Se eu vou pelas propriedades do botao para localizar o tag ele se encontra aqui:

Pression Action
&Set /Pot_Bio::[Pot_Bio]AT300D.OCmd_Reset 1

Desta forma funciona mas tenho que adicionar muito mais destas linhas e com isto prefiro fazer via script.

Como faco via script para localizar o caminho do meu tag que esta online, para mim dar um set nele?

Se alguem puder me ajudar agradeco.



He is saying


I'm having trouble solving a problem here, I'd like to know who can help me.
I have to send a command to several tags to reset some of their alarms.
With this I would like to know how I do via Script - Vba to give a set in the OCmd_Reset tag via script button pressing.
If I go through the properties of the button to locate the tag it is here:
Pression Action

* Set /Pot_Bio::[Pot_Bio]AT300D.OCmd_Reset 1


How do I view script to find the path of my tag that is online?
This way it works but I have to add a lot more of these lines and with this I prefer to do via script.
If anyone has any examples that can help me, thank you.

Translated
 

Similar Topics

Hi, i work on the display where i have list of tags. This names of tags are retrieved from external database. The full name of every tag is...
Replies
4
Views
3,835
hi guys, iam using vb to display a popup message when a button is clicked, the popup displayed needs to dependent on the state of the tag...
Replies
2
Views
3,245
Hi, I have 6 fillers, which all run the same. I want to send a value to the same tag address in each of the fillers using FactoryTalk Studio ME...
Replies
4
Views
2,620
I have a FactoryTalk View Se project, Is it possible to export Direct Reference tags to edit in a CSV file or Excel? I know I can export HMI...
Replies
1
Views
267
Expert, Could you advise me some idea how to add tags in Summary Alarm's FilterDefinition? SumView.FilterDefinition = "AlarmShortName LIKE...
Replies
2
Views
881
Back
Top Bottom