Sign in to follow this  
Followers 0
Jake104

FTview 7.0 - how do I make a Macro run a VBA-routine?

6 posts in this topic

I would like a Macro to run a VBA routine (that I wrote for a special purpose).

How is that done?

Share this post


Link to post
Share on other sites

Well, that depends on how you want the macro to run.  At startup only?  After an event?  After a button press?

Refer to page 494.  

http://literature.rockwellautomation.com/idc/groups/literature/documents/um/viewme-um004_-en-e.pdf

You create a tag in the HMI; this tag will be used to trigger execution of the macro; if you want the macro to execute with a button press action, you add the animation to the button to toggle the state of the new tag (which in turn executes the macro).

Share this post


Link to post
Share on other sites

I got the logic set up to run a macro based on an event.

But can I make the macro run a VBA routine?

That's my issue.

I want to run VBA when my event occurs.

If I can run a VBA-routine from a Macro - then i'm fine - but ideally I would just have the event run the VBA directly (without a Macro calling the VBA-routine).

Share this post


Link to post
Share on other sites

Yes, this is possible.

You can put a numeric input on a portion of the display where it isn't seen (behind something else).You can make it very small as well

as you won't be interacting with it.

If you're going to fire the event based on the value of an HMI or PLC tag, you can put that in the 'Value' field on the 'Connections' tab of the numeric input.

If the value is changed by other VBA code, you can leave the 'Value' field empty.

Next, go into 'Property Panel' for that numeric input and change the 'Expose to VBA' property to 'VBA Control'.

Once that is done, you should be able to right-click on the numeric input and select 'VBA Code...'

That will take you into the VBA Editor and drop you into the 'Change' event code window for the numeric input.

('Change' is one of 9 possible events available for a numeric input.)


Now you add your code.

3 people like this

Share this post


Link to post
Share on other sites

Boa tarde 

Gostaria de saber tambem como coloco um script dentre de um macro pra deixar rodando todo tempo? O Script ja tenho pronto.

Meu objectivo e deixar rodando este script toda hora por tras da tela para atulizar valores.
Alguem pode me ajudar?
 

Edited by gabrielcembranel

Share this post


Link to post
Share on other sites
On ‎6‎/‎7‎/‎2019 at 1:26 PM, gabrielcembranel said:

Boa tarde 

Gostaria de saber tambem como coloco um script dentre de um macro pra deixar rodando todo tempo? O Script ja tenho pronto.

Meu objectivo e deixar rodando este script toda hora por tras da tela para atulizar valores.
Alguem pode me ajudar?
 

Você pode usar um evento na FTView para alterar o valor de uma marca de memória IHM que está vinculada a uma entrada numérica em uma tela que está sempre em segundo plano (ela precisa permanecer carregada na memória). O evento _Change na entrada numérica seria usado para executar seu script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0