Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem using RTD in EXcel 2003

Hi,

I'm trying to read values every second from an RTD server to an Excel
spreadsheet using a macro. Problem is when I run the macro, values from
the RTD server is not updated. I've tried to set the calculation mode to
manual, and then force a calculation everytime I want to read data, but
it doesn't work. It gives me the same value all the time. Here's the
code I'm using:

Public Sub Start_Logging()

Dim x As Integer

Dim intNewHour As Integer
Dim intNewMinute As Integer
Dim intNewsecond As Integer
Dim varWaitTime As Variant

blnLogg = True
x = 1

Application.Calculation = xlCalculationManual

Worksheets("Sheet1").Activate
ActiveSheet.Cells(1, 1).Select

Do
'Set logging to every second
intNewHour = Hour(Now())
intNewMinute = Minute(Now())
intNewsecond = Second(Now()) + 1
varWaitTime = TimeSerial(intNewHour, intNewMinute, intNewsecond)
Application.Wait varWaitTime

'Do full calculation
Application.CalculateFull

'Write new value to cells
ActiveSheet.Cells(x, 1).Value = TIME
ActiveSheet.Cells(x, 2).Value = ActiveSheet.Range("e2").Value

x = x + 1

DoEvents

Loop Until blnLogg = False

Application.Calculation = xlCalculationAutomatic

End Sub

If I place a comment mark in front of the "do" and "do until..." and
"application.calculation....", so I have to run the macro everytime to
read/write values, it's working. So the problem has something to do with
the Do...Loop.

The blnLogg is a flag I use, so I can stop updating pressing another
button, setting the flag to false.

Running Windows XP SP2, Excel 2003.

Regards,

Anders Frafjord
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy and paste problem Excel 2003 to Word 2003 [email protected] Excel Discussion (Misc queries) 2 August 28th 07 11:14 AM
Excel 2003 problem DebbieK Excel Discussion (Misc queries) 0 August 30th 06 10:59 PM
Excel 2003 Add-In problem [email protected] Excel Programming 0 March 11th 06 02:01 PM
VBA problem with excel 2003 Jim Thomlinson[_4_] Excel Programming 2 September 22nd 05 08:25 PM
Problem with Excel 2003 and ole and vb Darkwing Excel Programming 0 October 28th 04 08:57 PM


All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"