+ Reply to Thread
Results 1 to 3 of 3

linking and automatically updating excell cell with a value in another file

  1. #1
    Registered User
    Join Date
    08-14-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    13

    linking and automatically updating excell cell with a value in another file

    I want to automatically read and update values in a cell from values in a text file.

    The text file gets updated by another program every second or so. I want my excel sheet to read value from that .txt file and automatically update the cell whenever the value in that notepad file updates .

    How can I do that??

    The text file format is something like

    Number Value Quantity
    1 50 800
    8 7 456
    9 8 245

    The text file is on another machine.

  2. #2
    Registered User
    Join Date
    08-14-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: linking and automatically updating excell cell with a value in another file

    I am trying to call the StartForexRead function from Excel cell like this

    = StartForexRead("C:\\myfile.log", 5)

    I added breakpoints. It hits the break point in StartForexRead and StartTime functions but it never gets to the "ReadValue" procedure.
    What am I missing wrong here??

    When I run the STartTimer sub from Visual Basic Editor it works just fine and REadValue() gets invoked.

    Public sFliePath As String
    Public iTimeDelay As Integer
    Public RunTime As Double

    Function StartForexRead(filePath As String, timeDelaySeconds As Integer)
    ''This function gets called
    sFliePath = filePath
    iTimeDelay = timeDelaySeconds
    StartTimer

    End Function


    Sub StartTimer()
    ''This function gets called as well
    RunTime = Now + TimeSerial(0, 0, iTimeDelay)
    Application.OnTime EarliestTime:=RunTime, Procedure:="ReadValue", Schedule:=True

    End Sub



    Sub ReadValue()
    ''This never gets invoked
    Dim sText As String

    ''Close any open text files
    Close


    ''Write the entire file to sText
    Open sFliePath For Input Access Read As 1
    sText = Input$(LOF(1), 1)
    Close
    ''MsgBox "abc"
    Range("A1") = sText
    StartTimer

    End Sub

  3. #3
    Registered User
    Join Date
    08-14-2009
    Location
    Toronto
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: linking and automatically updating excell cell with a value in another file

    4 days and no reply...hmm
    Any ideas???

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1