Public Sub genexcel() Dim XL As Excel.Application Dim WB As Excel.Workbook Dim Sheet As Excel.Worksheet XL = CreateObject("Excel.Application") XL.Visible = True WB = XL.Workbooks.Add Sheet = WB.ActiveSheet Sheet.Activate() XL.Visible = True XL.UserControl = True Sheet = Nothing WB = Nothing XL = Nothing