Solved

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

Posted on 2004-04-30
9
720 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access - Capture pressed key onclick 4 47
Run code from text file in vb 1 101
Send outlook email from VBS Script 2 67
Excel Web Add-in Where is Visual Basic used 9 77
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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…

734 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