dim xlsApp as Excel.Application . . . xlsApp.DisplayAlerts = False
Private Sub Command1_Click() Dim xlsap As New Excel.Application Dim xlsbook As Excel.Workbook Dim xlssheet As Excel.Worksheet xlsap.Visible = True Set xlsbook = xlsap.Workbooks.Add Set xslsheet = xlsbook.Worksheets("sheet1") Cells(1, 1) = "abc" Cells(1, 2) = "xyz" xlsap.DisplayAlerts = False Range("A1:B1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = False End With
.
.
.
xlsApp.DisplayAlerts = False
Dim xlsap As New Excel.Application
Dim xlsbook As Excel.Workbook
Dim xlssheet As Excel.Worksheet
xlsap.Visible = True
Set xlsbook = xlsap.Workbooks.Add
Set xslsheet = xlsbook.Worksheets("sheet1")
Cells(1, 1) = "abc"
Cells(1, 2) = "xyz"
xlsap.DisplayAlerts = False
Range("A1:B1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Merge
'..... End Sub
xlsApp.DisplayAlerts = False