Solved

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

Posted on 2004-04-30
9
715 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:cckleong
ID: 10979324
u are correct both times. but what about DDE....wouldnt that do it?
0
 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

813 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

14 Experts available now in Live!

Get 1:1 Help Now