ник: АлаяЗаря
вот код
Private Sub Кнопка0_Click()
Dim xlapp As Excel.Application
Dim xlmacro As Excel.Workbook
Dim xlbook As Excel.Workbook
Dim xlsheet As Excel.Worksheet
Dim export As String
export = CurrentProject.Path & "\экспорт " & Format(Date, "dd.mm.yyyy") & ".xls" 'Имя сохраняемого файла
If export = "" Then Exit Sub
DoCmd.OutputTo acQuery, "query1", acFormatXLS, export, False, "", 0
Set xlapp = CreateObject("Excel.Application")
Set xlbook = xlapp.Workbooks.Open(export)
Set xlsheet = xlbook.Worksheets("query1")
xlsheet.Name = "вот она"
With xlsheet
.Range(.Cells(2, 1), .Cells(12, 1)).Select
.Application.DisplayAlerts = False
.Application.Selection.Merge
.Range(.Cells(2, 2), .Cells(12, 2)).Select
.Application.DisplayAlerts = False
.Application.Selection.Merge
.Range(.Cells(2, 3), .Cells(12, 3)).Select
.Application.DisplayAlerts = False
.Application.Selection.Merge
.Range(.Cells(13, 1), .Cells(17, 1)).Select
.Application.DisplayAlerts = False
.Application.Selection.Merge
.Range(.Cells(13, 2), .Cells(17, 2)).Select
.Application.DisplayAlerts = False
.Application.Selection.Merge
.Range(.Cells(13, 3), .Cells(17, 3)).Select
.Application.DisplayAlerts = False
.Application.Selection.Merge
.Cells.Select
.Application.Selection.Interior.ColorIndex = xlNone
With .Application.Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Application.Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Range("A1").Select
End With
xlapp.Visible = True
xlbook.Save
Set xlapp = Nothing
Set xlbook = Nothing
End Sub
и сама БД