在VB对Excel进行写入数据时,如何把其中的一个单元格的字体大小进行设置,还有 使用xlSheet.Range("B5:B6").BorderAround 1, xlThin, xlColorIndexAutomatic, 0 这个语句时运行没有问题,我想问如通过参数进行传递,如 pont1=C5 , pont2=C6 通过 xlSheet.Range("'"& pont1 &"': '"& pont2 &"'").BorderAround 1, xlThin, xlColorIndexAutomatic, 0 进行,但这样用时老出错?不知道为什么?希望大家帮一下忙!

解决方案 »

  1.   

            With xlSheet
                .Range(.Cells(1, 1), .Cells(1, 9)).Font.Name = "黑体"
                '设标题为黑体字
                .Range(.Cells(1, 1), .Cells(1, 9)).Font.Bold = True
                '标题字体加粗
                .Range(.Cells(1, 1), .Cells(1, 9)).Borders.LineStyle = xlContinuous
                '设表格边框样式
            End With
      

  2.   

    字体是用 .Range(.Cells(1, 1), .Cells(1, 9)).Font.size=18 吗? 还有参数如何进行赋值呢?