Write values into existing Excel File with Outlook VBA: Workbook ishidden!

G

Gary Schneider

Hello world,

I am writing directly into an existing Excel file with Outlook VBA,
using the following subroutine (example only). The routine terminates
correctly. When I reopen the file manually, Excel displays it hidden!
But why? There is no code to hide it in my subroutine...

Can anyone help?


'--------------------------------------
Sub test()

Dim xlApp As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet

Set xlApp = New Excel.Application
Set wb = GetObject("C:\Temp\t1.xls")
Set ws = wb.Worksheets("myWorksheet")

ws.Cells(2, 1).Formula = "TEST"

wb.Close Savechanges:=True
xlApp.Quit

Set ws = Nothing
Set wb = Nothing
Set xlApp = Nothing

End Sub
'--------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top