是哪一个函数?
能给出例程最好
我在线给分

解决方案 »

  1.   

    Range("A1:A3").Select
        With Selection
            .MergeCells = True
        End With
      

  2.   

    Range("A1:A6").Select
        With Selection
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlBottom
            .WrapText = False
            .Orientation = 0
            .AddIndent = False
            .ShrinkToFit = False
            .MergeCells = False
        End With
        Selection.Merge
      

  3.   

    你可以用Excel的宏录制功能,把生成的代码,copy至你的程序中
      

  4.   

    'Rerferences to Microsoft Excel 9.0 Object Library
    Private Sub Command1_Click()
        Dim appExcel As Excel.Application
        Dim rngMerge As Excel.Range
        '...
        Set rngMerge = appExcel.Range("A1:F10")
        With rngMerge
            .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlBottom
            .WrapText = flase
            .Orientation = 0
            .AddIndent = False
            .ShrinkToFit = False
            .MergeCells = False
        End With
    End Sub
      

  5.   

    Range("A1:A3").Select
        With Selection
            .MergeCells = True
        End With
     Dim myexcel As Excel.Application
     Dim mybook As Excel.Workbook
     Dim mysheet As Excel.Worksheet
     Dim n As Integer
     Dim m As Integer
     Dim i As Integer
     Dim str As String
     
        Set myexcel = New Excel.Application
        Set mybook = myexcel.Workbooks.Add
        Set mysheet = mybook.Worksheets(1)    myexcel.Visible = True
        myexcel.Caption = "ͨ´æͨ¶Ò»Øµ¥Áбí"    myexcel.ActiveSheet.PageSetup.CenterHeader = ""
    myexcel.ActiveSheet.PageSetup.RightHeader = ""
        
        str = stroutput()
        i = 0
        Set restore = DBEngine.OpenDatabase(App.Path & "\restore.mdb")
        Set itemrs = restore.OpenRecordset(str, , 1, 3)
     
        i = 0
          itemrs.MoveLast
          n = itemrs.RecordCount + 1
          With mysheet
          .Range(.Cells(1, 1), .Cells(n, 11)).Font.Size = 10
          .Range(.Cells(1, 1), .Cells(n, 11)).HorizontalAlignment = xlCenter
          .Range(.Cells(2, 8), .Cells(n, 8)).HorizontalAlignment = xlRight
          .Range(.Cells(2, 5), .Cells(n, 5)).HorizontalAlignment = xlLeft
          .Range(.Cells(2, 7), .Cells(n, 7)).HorizontalAlignment = xlLeft
          End With
          
          n = 1
          mysheet.Cells(n, 1).Value = ""
          mysheet.Cells(n, 2).Value = ""
          mysheet.Cells(n, 3).Value = ""
          mysheet.Cells(n, 4).Value = ""
          mysheet.Cells(n, 5).Value = ""
          mysheet.Cells(n, 6).Value = ""
          mysheet.Cells(n, 7).Value = ""
          mysheet.Cells(n, 8).Value = ""
          mysheet.Cells(n, 9).Value = ""
          'mysheet.Cells(n, 10).Value = ""
          'mysheet.Cells(n, 11).Value = ""
          
          m = itemrs.RecordCount + 1
          itemrs.MoveFirst
         For n = 2 To m
          i = i + 1
          mysheet.Cells(n, 1).Value = i
          mysheet.Cells(n, 2).Value = itemrs!credkind
          mysheet.Cells(n, 3).Value = itemrs!credno
          mysheet.Cells(n, 4).Value = itemrs!lendno
          mysheet.Cells(n, 5).Value = itemrs!lendname
          mysheet.Cells(n, 6).Value = itemrs!borrno
          mysheet.Cells(n, 7).Value = itemrs!borrname
          mysheet.Cells(n, 8).Value = itemrs!Money
          mysheet.Cells(n, 9).Value = itemrs!digest
          
          mysheet.Cells(n, 10).Value = ""
          mysheet.Cells(n, 11).Value = ""
          itemrs.MoveNext
          Next n
          
          myexcel.Columns("a:k").AutoFit