PC Review


Reply
Thread Tools Rate Thread

Auto refresh and DDE update is not work when running macro

 
 
Eddy
Guest
Posts: n/a
 
      13th Jul 2004
Hi all,

I used to monitor my updated stocks quotes in an excel file (stock.xls)
where the data comes from an html websites (iexplorer exports to ms-excel).
Data refresh interval is not less than 1 minute.

I need to save the txt format of my worksheet every one minute for a purpose.
A friend of mine assists me to create a simple macro like this below:

======================
Sub savetext()

'
' kirim Macro
' Macro recorded 3/14/2004 by Eddy
'
' Keyboard Shortcut: Ctrl+k
'
On Error Resume Next

Dim PauseTime, Start, Finish
MsgBox "Starting Macro (save to c:\data.txt)"
PauseTime = 60 ' Set duration.
Start = Timer ' Set start time.
Do While 1

If Timer > Start + PauseTime Then
'MsgBox "saving"
Finish = Timer

ActiveWorkbook.SaveCopyAs "c:\data.xls"

Workbooks.Open "c:\data.xls", 3
'ActiveWorkbook("BARU").Activate

'Shell ("del c:\data.txt")
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile "c:\data.txt", True

ActiveWorkbook.SaveAs "c:\data.txt", xlTextMSDOS
ActiveWorkbook.Close True

Start = Timer
Else
DoEvents ' Wait
End If
Loop

End Sub

==================================

This macro really did saving a file called 'data.txt' every one minute
via a workbook backup file called 'data.xls',
but when this macro run, it results the excel's auto refresh is not work

It also occurs when I run a worksheet where the data comes from a DDE server.

I have set macro security level to low and trust every source.


Thanks for any suggestion

EDDY
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for auto refresh Kim Microsoft Excel Misc 1 6th Oct 2009 02:22 PM
Commandbar will not refresh while macro is running shelfish Microsoft Excel Programming 3 15th Jul 2008 12:59 AM
Running a macro from an auto-refresh Chris Youlden Microsoft Excel Worksheet Functions 2 7th Oct 2007 04:22 PM
Auto-run macro after auto-query refresh (Excel2000,sr1) =?Utf-8?B?QmlsbCBDdWZmbGlu?= Microsoft Excel Programming 3 29th Jun 2006 03:30 AM
running a macro on every refresh of the screen shovit sahai Microsoft Excel Programming 5 2nd Mar 2005 10:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:04 AM.