<form id="hbx9t"></form>

<noframes id="hbx9t">

    <em id="hbx9t"><span id="hbx9t"></span></em>

        <noframes id="hbx9t"><address id="hbx9t"><th id="hbx9t"><progress id="hbx9t"></progress></th></address>
        office交流網--QQ交流群號

        Access培訓群:792054000         Excel免費交流群群:686050929          Outlook交流群:221378704    

        Word交流群:218156588             PPT交流群:324131555

        Access中對Excel文件設置字體格式

        2021-01-07 08:00:00
        tmtony8
        原創
        6383

        access 除了把數據導出到Excel中,還需要對導出的數據設置一定的字體格式。

        比如設置表頭格式,這樣能更加醒目地看出表格的內容。

        如這里先對所有已使用的單元格設置格式,再對表頭設置格式(字號14,字體微軟雅黑,加粗,顏色變深)

         Dim xlWbk As Excel.Workbook
            Dim xlWsh As Excel.Worksheet
            Set xlApp = GetObject(, "Excel.Application")
            xlApp.Visible = True
            Set xlWbk = xlApp.Workbooks.Open(CurrentProject.Path & "\示例1.xlsx")
            Set xlWsh = xlWbk.Worksheets(1)
            xlWsh.Activate
            
            With xlWsh.UsedRange     '設置已使用的單元格區域格式
                .Font.Name = "Times New Roman "
                .Font.Size = 10
            End With
            
            With xlWsh.Range("1:1")    '設置第一行的單元格區域格式
                .Font.Size = 14
                .Font.Name = "微軟雅黑"
                .Font.Bold = True
                .Font.TintAndShade = True
            End With
            
            Set xlWsh = Nothing
            Set xlWbk = Nothing
            Set xlApp = Nothing

        設置效果如圖:

          分享