正在刷新 excel 文件 vb.net

Refreshing excel file vb.net

我在 visual studio 2013 年创建了一个表单,它将数据从表单填充到 excel sheet。 sheet 当用户在表单中输入数据时打开。我想要的是,当用户在表单中输入数据并将其填充到 excel sheet 时,文件应该得到刷新,以便每个人都可以看到。文件处于共享模式。

我试过了

xlworkbook.refreshall() 'xlworkbook is my excel workbook

但是它抛出一个错误:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Quote.exe

Additional information: Exception from HRESULT: 0x800A03EC

我该如何解决这个问题?请帮忙!

我不明白文件是否在屏幕上打开,但如果你想看到所有的变化,你需要保存文件。

那么你必须使用"Save"方法而不是"RefreshAll"

当你分享一个Excel文件时,在高级选项下,有'Update changes to save the file',勾选标志就勾选。