答案 0 :(得分:1)
您可以在VBA中执行此操作。在你的" ThisWorkbook"模块,创建一个看起来像这样的Sub Workbook_Open()
Module1.RefreshEveryMinute
End Sub
事件:
Module1
然后,在你的Public Sub RefreshEveryMinute()
ThisWorkbook.RefreshAll
nextRunTime = Now + TimeValue("00:01:00")
Application.OnTime nextRunTime, "RefreshAllData"
End Sub
模块/类中,实际进行刷新的代码看起来像这样:
void CFile03Dlg::OnSelchangeCombo()
{
// TODO: Add your control notification handler code here
int n= m_SSubject.GetCurSel();
arr[n]=m_SMarks;
}
void CFile03Dlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
int h=0;
CStdioFile file_object(L"D:\\Docs\\Student.txt",CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate);
CString fc1=m_SName, fc2=m_SClass, fc3=m_SRoll, fc4;
file_object.SeekToEnd();
for(h=0;h<3;h++)
{
fc4.Format(L"%d", arr[h]);
}
file_object.WriteString(L"Name: ");
file_object.WriteString(fc1);
file_object.WriteString(L"\n");
file_object.WriteString(L"Class: ");
file_object.WriteString(fc2);
file_object.WriteString(L"\n");
file_object.WriteString(L"Roll No.: ");
file_object.WriteString(fc3);
file_object.WriteString(L"\n");
// file_object.WriteString(L"Name:");
CString selection;
for(h=0;h<3;h++)
{
if(h==0)
{
m_SSubject.GetLBText(h, selection);
file_object.WriteString(selection);
file_object.WriteString(L" Marks: ");
file_object.WriteString(fc4);
}
else if(h==1)
{
m_SSubject.GetLBText(h, selection);
file_object.WriteString(selection);
file_object.WriteString(L" Marks: ");
file_object.WriteString(fc4);
}
else if(h==2)
{
m_SSubject.GetLBText(h, selection);
file_object.WriteString(selection);
file_object.WriteString(L" Marks: ");
file_object.WriteString(fc4);
}
else if(h==3)
{
m_SSubject.GetLBText(h, selection);
file_object.WriteString(selection);
file_object.WriteString(L" Marks: ");
file_object.WriteString(fc4);
}
file_object.WriteString(L"\n");
}
file_object.WriteString(L"\n");
UpdateData(FALSE);
}