Solved

data collection from siemens S7-200 controller using VB and excel

Posted on 2004-04-30
9
712 Views
Last Modified: 2012-05-04
i have a siemens s7-200 controller talking to a VB application. the inputs to the controller shows up on the VB form which ive created.

How can i link an excel spreadsheet to the VB application so that the "date and time" of changes to the values in the VB controls are sent to an excel spreadsheet??
0
Comment
Question by:cckleong
  • 6
  • 2
9 Comments
 
LVL 9

Expert Comment

by:leechoonhwee
ID: 10965915
Well...the excel part can be done out of the VB. Just export your data to a DB and you can use Microsoft Query to query and display the data in excel.
0
 

Author Comment

by:cckleong
ID: 10967505
uhhhh no.....i m using vb as my frontend for the controller.

i want vb to write data from my controller into an already opened excel spreadsheet.
0
 
LVL 9

Expert Comment

by:leechoonhwee
ID: 10973996
I dun think VB can send the data to an open excel cuz it will be locked by excel and an error will be generated. You can however, force the program to open an excel whenever there is an update but I dun think that is productive and operationally viable.
0
 

Author Comment

by:cckleong
ID: 10979324
u are correct both times. but what about DDE....wouldnt that do it?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:cckleong
ID: 10981760
This is as far as i know how to go.......it works but everytime the event changes it overwrites the previous. i want it to go to the next row on the spreadsheet so that i dont lose the previous information.

help me.....please


Dim Message As Variant

Private Sub BtnFreezer1High_Change()

    If BtnFreezer1High.Value = False Then
        Message = "Freezer 1 High"
    Else
        Message = "Freezer 1 OK"
    End If

txtArchive.LinkMode = 0
txtArchive.LinkTopic = "Excel|MyBook.xls"
txtArchive.LinkItem = "R1C1"
txtArchive.LinkMode = 1

txtArchive.Text = Date & " " & Time() & " " & Message

txtArchive.LinkPoke

txtArchive.LinkExecute "[SELECT(""R2C1"")]"

txtArchive.LinkMode = 0

End Sub
0
 

Author Comment

by:cckleong
ID: 10998031
anyone has any idea???
0
 

Author Comment

by:cckleong
ID: 11015306
I SOLVED IT.....
0
 

Accepted Solution

by:
cckleong earned 0 total points
ID: 11078438
My solution using DDE

Dim Message As Variant

Private Sub BtnFreezer1High_Change()

    If BtnFreezer1High.Value = False Then
        Message = "Freezer 1 High"
    Else
        Message = "Freezer 1 OK"
    End If

txtArchive.LinkMode = 0
txtArchive.LinkTopic = "Excel|MyBook.xls"
txtArchive.LinkItem = "R[-1]C1"                'links the cell above the active cell
txtArchive.LinkMode = 1

txtArchive.Text = Date & " " & Time() & " " & Message

txtArchive.LinkPoke

txtArchive.LinkExecute "[SELECT(""R[1]C"")]"                     'makes the cell below active

txtArchive.LinkMode = 0

End Sub
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now