Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

DDE with macros

I am running a Lookout application using a DDE client link to an Excel spreadsheet.  The spreadsheet loops through simulated data using a macro (see below) to simulate real-time data.  The macro simply copies data from one row and pastes it into the linked row and then "sleeps" for 5 seconds and does it again until it runs out of data.  When I step through this macro manually (using function key F8) the data updates as expected in the Lookout application.  However, if I run the macro automatically, the data only updates for the first and last data points.  All other data is never displayed.  Very puzzling! Has anyone seen this type of problem before?  Any help would be appreciated.
 
Thanks,
 
 
 Sub FPEDATA()
'

'
'
    LenTime = 0
    Do While LenTime < 6
    Sheets("Page_simulation").Select
    Columns("B:B").Select
    Sheets("Page_simulationhistory").Select
    Columns("B:B").Select
    Selection.Insert Shift:=xlToRight
    ActiveWindow.SmallScroll ToRight:=1
    Selection.ColumnWidth = 15.14
    ActiveWindow.SmallScroll ToRight:=-1
    Sheets("Page_simulation").Select
    Selection.Copy
    Sheets("Page_simulationhistory").Select
    'Columns("B:B").Select
    'Selection.Insert Shift:=xlToRight
    Range("B1").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Application.CutCopyMode = False
    With Selection
        .HorizontalAlignment = xlRight
        .VerticalAlignment = xlBottom
        .Orientation = 0
        .AddIndent = False
        .ShrinkToFit = False
        .MergeCells = False
    End With
    Range("B6").Select
    Selection.NumberFormat = "m/d/yy h:mm AM/PM"
    Columns("B:B").ColumnWidth = 20.29
    Sheets("Page_simulation").Select
    Range("C6:J190").Select
    Selection.Copy
    ActiveWindow.ScrollColumn = 1
    ActiveWindow.ScrollRow = 1
    Range("B6").Select
    ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
        IconFileName:=False
     LenTime = LenTime + 1
     Sleep (5000)
   
    Loop
   
End Sub
0 Kudos
Message 1 of 1
(5,837 Views)