- Community Home
- >
- Servers and Operating Systems
- >
- HPE BladeSystem
- >
- Legacy
- >
- BackOffice Products
- >
- As promised a real excel 2000 macro thread: Contro...
Categories
Company
Local Language
Forums
Discussions
- Integrity Servers
- Server Clustering
- HPE NonStop Compute
- HPE Apollo Systems
- High Performance Computing
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp Software
Knowledge Base
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 02:25 PM
11-30-2004 02:25 PM
The process is simple
Refresh the data then record/save the data in xml format.
Here is the refresh/save macro code:
Sub Macro4()
'
' Macro4 Macro
' Macro recorded 11/30/2004 by YEVKA
'
'
ActiveWorkbook.RefreshAll
Application.Run "model.xls!modelpublish"
End Sub
Problem: The refresh takes a little time. If I run this code with run macro the publish code runs and the refresh code gets interupted.
I'd like to build some kind of control loop around the refresh so no more code executes until the control loop won't let the next line of code execute.
Here is what I want in English language:
ActiveWorkbook.RefreshAll
until refresh is done
do
sleep 1
done
if successful (return code 0 in unix-speak) then
Application.Run "model.xls!modelpublish"
fi
I've used Unix control structures.
The current process is manual. That requires me to log onto a computer and do work.
Two goals. Certain Jewish holidays prevent me from operating a computer. I'd like the site to get its update anyway with a windows scheduled job or whatever.
Second goal: I'd like the darn website to get updated even when I'm busy.
This publish part is great. It saves the data, fires up an ftp script and really does a very nice job.
Bunny for some macro code.
Have at it.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-30-2004 11:57 PM
11-30-2004 11:57 PM
Re: As promised a real excel 2000 macro thread: Control loop for data refresh
Is refreshall a function or procedure inside your current workbook??
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2004 12:59 AM
12-01-2004 12:59 AM
Re: As promised a real excel 2000 macro thread: Control loop for data refresh
Its a built in function part of the external data tools that ship with excel. I get the code by doing macro record and pressing the refesh button.
If need be I can post the whole spreadsheet.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2004 06:16 AM
12-01-2004 06:16 AM
Re: As promised a real excel 2000 macro thread: Control loop for data refresh
I read some more documents about this refreshall.. and looks like this command sometimes works as an asynchronous (meaning excutes the next steps before this is completed succesfully) command.
So as an workaround.. I was thinking to check for a value in a particular cell which gets updated by refreshAll.. so create a loop and check whether the cell is updated with the particular value and once it is done then we can run the publish procedure..
if this is ok let me know and i can write a script for that..
Ganesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2004 09:00 AM
12-01-2004 09:00 AM
Re: As promised a real excel 2000 macro thread: Control loop for data refresh
I'd like to know how to write a control loop regardless. If you need the spreadsheet, indicate and I'll upload and attach it.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2004 03:50 PM
12-02-2004 03:50 PM
Re: As promised a real excel 2000 macro thread: Control loop for data refresh
Bunny alert!
Dexter Filmore???
Regards,
Steven
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2004 04:15 AM
12-07-2004 04:15 AM
Re: As promised a real excel 2000 macro thread: Control loop for data refresh
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffsol02/html/odc_WellkeptSecret.asp
I'm going to try it and see what happens. At this point I have no idea how to do this and will award a bunny for step by step on how to do so.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2004 11:31 AM
12-07-2004 11:31 AM
SolutionSomething like:
Sub Macro4()
ActiveWorkbook.RefreshAll
End Sub
Sub Macro5()
Application.Run "model.xls!modelpublish"
End Sub
I have a few other ideas but would need your Excel program and macros to try them out so go ahead and attach it or you can send it directly to me at
rkinner at att dot net
Most of what little VBA experience I have is in Access but it is about the same.
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2004 11:52 AM
12-07-2004 11:52 AM
Re: As promised a real excel 2000 macro thread: Control loop for data refresh
Thanks for posting in.
I have discovered that each data area in the spreadsheet has a property for background data refresh. It apparently defaults to enable.
I just went through a spreadsheet disabled it and got a macro to run and it waited for the data to update before going to the next step.
So apparently a control loop, may not be necessary. I'm still looking to make further improvements though so I'm attaching my spreadsheet.
I'm wondering now how to program the Windows scheduler to kick the spreadsheet once a day running a particular macro.
I can now actually set up the websites stock indices to update themselves during the day, though that will tie up a computer.
I'm wondering whether the better idea is to use a control loop to run the collect and publish functions, leaving the spreadsheet open all day long.
Here is the spreadsheet I just fixed. This is not closed and I'm handing Ron a solution quality pointage, because you met the original question critera. Thanks for letting me get to point assignment prior to Merijn's statistics.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2004 04:22 AM
12-08-2004 04:22 AM
Re: As promised a real excel 2000 macro thread: Control loop for data refresh
I am really sorry for not sending the control loop before.. here is one which u can use it..
Sub controlloop()
'Test
Dim strdatetime As Date
Dim curdatetime As Date
Dim intdiff As Integer
strdatetime = Now
intdiff = 1
Do While True
curdatetime = Now
intdiff = DateDiff("n", strdatetime, curdatetime)
If intdiff >= 1 Then
strdatetime = Now
'ActiveWorkbook.ActiveSheet.Cells(1, 1).Text = curdatetime
msgbox curdatetime
Exit Do
End If
Loop
'yyyy Year
'q Quarter
'm Month
'y Day of year
'd Day
'w Weekday
'ww Week
'h Hour
'n Minute
's Second
The above loop is an infinite loop which will exit only if "Exit Do" statement is called. So u can right a condition when u want to come out of the loop..
Also i have put in a condition for running the data refresh & publish to for every minute (assuming they complete before 1 min)... u can change it to hours or days based on your frequency..
hope this helps..
Ganesh