With X1Sheet
          .Range("D" & 1 & ":G" & 1).Select
           X1App.ActiveCell.FormulaR1C1 = "FRAMES/LENS TRACE REPORT"
           X1App.Selection.MergeCells = True
     With X1App.Selection.Font
          .SIZE = 18
          .Bold = True
     End With
End with
 为什么不能改变字体的大小? 我将字体Size设为18,但是在EXCEL中打开看时却是Excel默认的10,为什么,哪里有问题??请教大家.....

解决方案 »

  1.   

    看不出来,应该是好的With X1Sheet
              .Range("D" & 1 & ":G" & 1).Select
               X1App.ActiveCell.FormulaR1C1 = "FRAMES/LENS TRACE REPORT"
               X1App.Selection.MergeCells = True
         With X1Sheet.Application.Selection.Font ''这里改成这样试试?
              .SIZE = 18
              .Bold = True
         End With
    End with
      

  2.   

    把c:\b.xls的A1:E9字号改为18号:Private Sub Command2_Click()
    Dim xlApp As Excel.Application
        Dim xlBook As Excel.Workbook
        Dim xlSheet As Excel.Worksheet
        Set xlApp = CreateObject("Excel.Application")
        Set xlBook = xlApp.Workbooks.Open("c:\b.xls")
        Set xlSheet = xlBook.Worksheets(1)
        xlApp.Visible = False
    With xlSheet
            Range("A1:E9").Select
        With Selection.Font
            .Name = "宋体"
            .Size = 18
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = xlAutomatic
        End With
    End With
          xlBook.Save
          Set xlSheet = Nothing
           Set xlBook = Nothing
           xlApp.Quit
           Set xlApp = Nothing
          MsgBox "ok"
    End Sub