非常標題。代碼前進,直到它碰到一條線,然後作用,就好像它遇到了Stop
命令,除了沒有這樣的行。VBA停止沒有代碼告訴它這樣做
StartDate = DateAdd("d", -1 * NDays + 1, EndDate) 'the immediately preceding line
'NDays is an integer, EndDate is a date
With Excel.Application 'the line that it stops on
.ScreenUpdating = True
.DisplayAlerts = True
.Calculation = xlAutomatic
End With 'I put these here because the next lines save the workbook
'if I put them before the excel.application stuff it asks if I want to save when closing
爲什麼它停在第二行?有人知道嗎?
格雷厄姆,期待這段代碼我假設你只發布了它的一部分?如果不是的話,那裏有一個End With ... –
無論如何,我認爲我們需要With語句中的整個代碼,因爲它只是鏈接到Excel.Application的一個包裝。也許可以多解釋一下代碼如何處理新打開的Excel實例,以及它是否等待任何操作在Excel中結束。應用 –
我剛剛發佈了兩個問題行。沒有奇怪的停止,整個事情很好(即沒有缺失的位),它只是停止。如果需要,我可以發佈更多。 –