Excel VBA
Option Explicit Sub ShowHourGlass() Application.Cursor = xlWait ‘Code here Application.Cursor = xlDefault End SubTip: In Excel, when running a long process you also do additionally things to speed up the apparent speed. Generally, the following propeties:
Application.ScreenUpdating and Application.DisplayAlerts are set to false and then turned back when the process ends.
Access VBA
DoCmd.Hourglass True
C#
try
{
objTask = new cTask();
strFileName = @"Z:\RMS\Back end\CDL\test CDL Reference Data - RMS.xls";
strAccessDb = @"H:\Projects\MDL\Locally Booked Update\WizardMDL Front End.accdb";
intStartTime = Environment.TickCount;
Application.UseWaitCursor = true;
recordsAffected = objTask.RefreshCDLReferenceFile(strFileName, strFileNameAccess: strAccessDb);
intEndTime = Environment.TickCount;
decElapsedTime = (decimal)((intEndTime - intStartTime) * .001);
MessageBox.Show("Imported " + recordsAffected.ToString() + " row(s) in " + decElapsedTime.ToString() + " sec(s)", "Results", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, program, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
finally
{
Application.UseWaitCursor = false;
}
No comments:
Post a Comment