I have a porgram that opens an excel workbook and modifies some data, but
almost randomly a box will pop up in the workbook telling me the file is now
available and to hit ok or cancel. This crashes my program. Is there a way
to open the workbook so that it does not display this box? I open the
workbook as an object because some people here use office 2000 and some use
xp
'create the xl object
Dim xl As Object
xl = CreateObject("Excel.Application")
Dim xlwb As Object = xl.Workbooks.Open(TextBox2.Text, notify:=False)
....... I've also tried Dim xlwb As Object =
xl.Workbooks.Open(TextBox2.Text, notify:=False)
Dim xlws As Object = xlwb.Sheets(1)
xl.displayalerts = False
xl.interactive = False
xl.Visible = True
If I put a stop before the code that writes to the workbook, I can clear the
box after it pops up and the program then continues on.
Here is an example of the code I use to write to the worksheet. Seems pretty
standard to me
if xlws.Cells(1, 1).value <> "Machine name" Then
xlws.Range("A1").EntireRow.Insert()
xlws.Range("a1", "z1").Font.Bold = True
xlws.Cells(1, 1).value = "Machine name"
xlws.Cells(1, 2).value = "MS04-041"
xlws.Cells(1, 3).value = "MS04-043"
xlws.Cells(1, 4).value = "MS04-044"
xlws.Cells(1, 5).value = "MS05-001"
xlws.Cells(1, 6).value = "MS05-002"
xlws.Cells(1, 7).value = "MS05-003"
xlws.Cells(1, 8).value = "Reboot Status"
End If