You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old April 10th, 2012, 03:24 PM   #1
kota_rt
Member
United States

kota_rt is offline
 
Join Date: Jan 2005
Location: Saginaw, Michigan
Posts: 11
FactoryTalk View SE VBA Tags to Excel

I'm looking for a better solution to place the values of 100 SLC N7 tags on an excel spreadsheet from a FactoryTalk View SE display VBA Subroutine. I can create a tag group in vba, add all the tag names to the group, get the values and write them to the excel spreadsheet. But there has got to be an easier way that I'm overlooking! In excel I can use a DDE Request and automate the process easily, but I really need to have FT View do the "driving" in this case. Does anyone have a better way to do this?
  Reply With Quote
Old April 10th, 2012, 03:53 PM   #2
jkerekes
Member
United States

jkerekes is offline
 
jkerekes's Avatar
 
Join Date: Aug 2007
Location: NJ
Posts: 2,179
I think what you want to do is have FTView write the tags directly to the Excel sheet. Are these values going to constantly overwrite the same cells or do you need to create a simple database of values? You need to expose the Excel object model in FTView VBA editor. Then you will have the Excel command to create a sheet and populate it with values. Excel will need to be installed on the FTView server to get the object model.
  Reply With Quote
Old April 11th, 2012, 01:32 AM   #3
rdrast
Lifetime Supporting Member
United States

rdrast is online now
 
rdrast's Avatar
 
Join Date: Apr 2003
Location: South Carolina Lowcountry
Posts: 5,302
That is the correct procedure for FTViews VBA.

You aren't creating the tag group every time though, are you? For code like that, I just put it in a hidden window, and create all the tag groups once on initialization, and then just refresh them prior to working with them.


I suppose, it might be 'easier', using SLC Files, to build up each tagname in a loop to add them to the collection.
__________________
------------------------------------
How to ask questions the SMART Way!

Look First, Ask Second!

  Reply With Quote
Old April 11th, 2012, 02:50 PM   #4
kota_rt
Member
United States

kota_rt is offline
 
Join Date: Jan 2005
Location: Saginaw, Michigan
Posts: 11
I was able to migrate code from excel vba to FT View SE VBA and got it working.
  Reply With Quote
Old April 11th, 2012, 03:03 PM   #5
jkerekes
Member
United States

jkerekes is offline
 
jkerekes's Avatar
 
Join Date: Aug 2007
Location: NJ
Posts: 2,179
Could you share the details for other people who may be following this thread? Thanks!
  Reply With Quote
Old June 15th, 2012, 03:33 AM   #6
bansodevb
Member
India

bansodevb is offline
 
Join Date: Jan 2010
Location: India
Posts: 28
Quote:
Originally Posted by kota_rt View Post
I was able to migrate code from excel vba to FT View SE VBA and got it working.
HI kota_rt,

I am also doing the same thing. Can you please write How you migrated the code to FTview.

Thanks

Vinod B. Bansode
  Reply With Quote
Old September 14th, 2012, 02:46 AM   #7
ghatevinod
Member
India

ghatevinod is offline
 
Join Date: Dec 2009
Location: pune
Posts: 9
Dear All;I'M Currently Using Factory Talk View SE (V6.1) SCADA. I Want to have Current Values of Tags (Process Parameters) to belogged in Excel Sheet by Every two Hr.s I'm Trying to write VBA Code to open Excel Sheet & Write the Values in This Excel Sheet & Close it Again. At next Day morning This Sheet will be saved by a name of the date.Can any body guide me for this.. Thanks!!!!!
  Reply With Quote
Old September 14th, 2012, 06:11 AM   #8
bansodevb
Member
India

bansodevb is offline
 
Join Date: Jan 2010
Location: India
Posts: 28
Hi ghatevinod

You Can try Below Script with some modification such as save file path and tags.



Private Sub NumericInput5_Change()
Dim sFileName As String, sPath As String
If MyTagGroup Is Nothing Then
Set MyTagGroup = Application.CreateTagGroup(Me.AreaName)
MyTagGroup.Add "AI\I1"
MyTagGroup.Add "AI\I2"
MyTagGroup.Add "AI\I3"
MyTagGroup.Add "AI\I4"

' On Error GoTo ErrorHandler
Dim SourceErrFile, DestErrFile
Dim Tag1 As Tag
Dim Tag2 As Tag
Dim Tag3 As Tag
Dim Tag4 As Tag

Dim Mytime
'Set the tag objects
Set Tag1 = MyTagGroup.Item("AI\I1")
Set Tag2 = MyTagGroup.Item("AI\I2")
Set Tag3 = MyTagGroup.Item("AI\I3")
Set Tag4 = MyTagGroup.Item("AI\I4")


Excel.Application.Workbooks.Open "C:\resourcelibrary\import.csv"
Excel.Application.Visible = True

Cells(2, 4) = Tag1.Value
Cells(3, 4) = Tag2.Value
Cells(4, 4) = Tag3.Value
Cells(5, 4) = Tag4.Value
ChDir "C:\resourcelibrary"


ActiveWorkbook.SaveAs Filename:="C:\resourcelibrary\Import" & "-" & Format(Now, "dd-mmm-yyyy-hh-mm-ss") & ".xls"


Filename:="C:\resourcelibrary\Import.xls" & Date & " " & Time


ActiveWorkbook.Close



End If
End Sub
  Reply With Quote
Old September 14th, 2012, 07:53 AM   #9
ghatevinod
Member
India

ghatevinod is offline
 
Join Date: Dec 2009
Location: pune
Posts: 9
Dear Bansodevb Thanks for the help....I have Some Query. What is me.AreaName, as our SCADA is Factory Talkview SE So whether it should be se.AreaName?Whether I shoul Write AI/I1 As AI/PT_111Our Tags Has not been Defined in SCADA System But He is Importing From Server Excel.Application.Workbooks.Open "C:\resourcelibrary\import.csv"In this whether I have to give the Path for Excel Application to Open? Like "c:\Programme file\microsoftoffice\office12\excel.exe" ??Also If you would like to share your Mail ID & Phone No. so that I can be in touch with You... Thanks Once againGhate Vinodghatevinod@gmail.com
  Reply With Quote
Old September 18th, 2012, 08:32 AM   #10
bansodevb
Member
India

bansodevb is offline
 
Join Date: Jan 2010
Location: India
Posts: 28
Are you browsing PLC tags directly in SE?

me.AreaName This is Script Syntax don't change it.
me is not ME(Machine Edition).

C:\resourcelibrary\import.csv this is Path of the .CSV file where tag values will be store.
  Reply With Quote
Old September 18th, 2012, 09:34 AM   #11
ghatevinod
Member
India

ghatevinod is offline
 
Join Date: Dec 2009
Location: pune
Posts: 9
Yes Tags are browse directly. They are not defined in SCADA. So does this path is valid for Import.csv is required in this case also.
Thanks!!!!!
  Reply With Quote
Old November 19th, 2012, 06:23 AM   #12
patilsandipb
Member
India

patilsandipb is offline
 
Join Date: Nov 2012
Location: mumbai
Posts: 4
Dear Bansodevb,

me.AreaName is Script Syntax. But it is showing error at 'me' while trying to run script as 'invalid use of Me keyword'. what to write in place of me?? else say any solution for it..
  Reply With Quote
Old November 19th, 2012, 08:48 PM   #13
bansodevb
Member
India

bansodevb is offline
 
Join Date: Jan 2010
Location: India
Posts: 28
Quote:
Originally Posted by patilsandipb View Post
Dear Bansodevb,

me.AreaName is Script Syntax. But it is showing error at 'me' while trying to run script as 'invalid use of Me keyword'. what to write in place of me?? else say any solution for it..

Where are you using this script?

This script is for FT View SE (VBA).
  Reply With Quote
Old November 19th, 2012, 10:58 PM   #14
patilsandipb
Member
India

patilsandipb is offline
 
Join Date: Nov 2012
Location: mumbai
Posts: 4
Dear Sir,
I am using this in FTVIEW SE (VBA) only. But m nt getting y it is showing the error.
It keep saying 'invalid use of ME keyword'. I need to define Me??
  Reply With Quote
Old November 20th, 2012, 04:05 AM   #15
bansodevb
Member
India

bansodevb is offline
 
Join Date: Jan 2010
Location: India
Posts: 28
Quote:
Originally Posted by patilsandipb View Post
Dear Sir,
I am using this in FTVIEW SE (VBA) only. But m nt getting y it is showing the error.
It keep saying 'invalid use of ME keyword'. I need to define Me??
Hi,

Post your script here.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Creating FT View SE Station Backup smohamed LIVE PLC Questions And Answers 6 March 30th, 2017 05:22 PM
FT View SE Help Tim Ganz LIVE PLC Questions And Answers 5 July 8th, 2011 07:03 PM
FT View Station and system Tags smohamed LIVE PLC Questions And Answers 3 January 19th, 2011 11:03 AM
FT View SE Tags Not Working southerndandy LIVE PLC Questions And Answers 1 May 24th, 2009 10:47 PM
RS View Machine- Missing Tags Coachman LIVE PLC Questions And Answers 5 October 30th, 2006 09:06 AM


All times are GMT -5. The time now is 02:51 PM.


.