I made a straightforward Access database with just 1 form and 1 button to execute code that starts a blank Excel document (with 1 worksheet) and enters "X" in the first cell. Although the workbook is hidden and needs to be manually unhidden, it performs the job. That is, when I open the excel file after the VBA code has run, everything is greyed out. The cell was updated as necessary, and all is OK if I click the "view" tab and choose the "Unhide" option. The workbook is not hidden if I remove the VBA line that writes "X" in the excel file. How can I fix the workbook being hidden issue?
Here is the code:
Private Sub Command0_Click()
Dim my_xl_app As Object
Dim my_xl_worksheet As Object
Dim my_xl_workbook As Object
Set my_xl_app = CreateObject("Excel.Application")
my_xl_app.UserControl = True
my_xl_app.Visible = False ' yes. I know it's the default
Set my_xl_workbook = GetObject("D:\Dropbox\MASAV\HIYUVIM\AAA.xlsx")
Set my_xl_worksheet = my_xl_workbook.Worksheets(1)
my_xl_worksheet.Cells(1, "A") = "V"
my_xl_workbook.Close SaveChanges:=True
Set my_xl_app = Nothing
Set my_xl_workbook = Nothing
Set my_xl_worksheet = Nothing
End Sub