none
How to set font bold in Excel with Access VBA After create.application and add worksheet

    Pregunta

  • both method below do not have bold font

    oMainWS.Cells(Val(Nz(rs.Fields("Row_No"), "")), (Asc(Mid(Nz(rs.Fields("Col_No"), ""), 1, 1)) - Asc("A") + 1) * 26 + Asc(Mid(Nz(rs.Fields("Col_No"), ""), 2, 1)) - Asc("A") + 1) = Nz(rs.Fields("Upload_Excel_Field_Name"), "")

    With oMainXL.Range(Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), ""))
    	.Font.Bold = True
    End With
    oMainXL.Range(Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "")).select
    With Selection
    	.Font.Bold = True
    End With


    就讓這一切隨風

    viernes, 25 de mayo de 2012 1:47

Respuestas

Todas las respuestas

  • I talked about this (and much more) in my July, 2005 Access Answers column Excelling Automatically


    Doug Steele, Microsoft Access MVP
    http://www.AccessMVP.com/djsteele (no e-mails, please!)
    Co-author Access Solutions — Tips, Tricks, and Secrets from Microsoft Access MVPs (ISBN 978-0-470-59168-0)

    viernes, 25 de mayo de 2012 1:53
  • tried the web following code no effect and have error

    With oMainWS
    	.Rows(Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "") & ":" & Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "")).Font.Bold = True
    End With
    Object define error
    With oMainWS
    	.Rows(Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "") & ":" & Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "")).Font.Bold = True
    End With
                                        


    就讓這一切隨風

    viernes, 25 de mayo de 2012 2:34
  • not work

    With oMainWS
                                            .Rows("1:1").Font.Bold = True
                                        End With
                                        
                                        If Nz(rs.Fields("Upload_Excel_Field_Name"), "") = "Project Cashflow Budget For The Year Ended" Or Nz(rs.Fields("Upload_Excel_Field_Name"), "") = "Project Budget For The Year Ended" Then
                                            oMainWS.Cells(Val(Nz(rs.Fields("Row_No"), "")), Asc(Nz(rs.Fields("Col_No"), "")) - Asc("A") + 1) = CStr(Nz(rs.Fields("Upload_Excel_Field_Name"), "") & " " & CStr(Format(CDate("31-" & Nz(cbMonthFr.Value, "") & "-" & Nz(Me.txtYearFr, "")), "dd-MMMM-yyyy")))
                                        Else
                                            oMainWS.Cells(Val(Nz(rs.Fields("Row_No"), "")), Asc(Nz(rs.Fields("Col_No"), "")) - Asc("A") + 1) = Nz(rs.Fields("Upload_Excel_Field_Name"), "")
                                        End If


    就讓這一切隨風

    viernes, 25 de mayo de 2012 6:49
  • all following not success

                                        oMainWS.Range(Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "")).select
                                        With oMainXL.ActiveCell.Font
                                            .Bold = True
                                        End With
                                        'Selection.Font.Bold = True
                                        'oMainWS.Columns.Font.Bold = True
                                        'Selection.Font.Bold = True
                                        'With oMainWS
                                            '.Range(Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "")).Font.Bold = True
                                            '.Rows(Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "") & ":" & Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), "")).Font.Bold = True
                                            '.Cells(Val(Nz(rs.Fields("Row_No"), "")), (Asc(Mid(Nz(rs.Fields("Col_No"), ""), 1, 1)) - Asc("A") + 1) * 26 + Asc(Mid(Nz(rs.Fields("Col_No"), ""), 2, 1)) - Asc("A") + 1).Font.Bold = True
                                        'End With
                                        'With oMainXL.Range(Nz(rs.Fields("Col_No"), "") & Nz(rs.Fields("Row_No"), ""))
                                          '.Font.Bold = True
                                        'End With


    就讓這一切隨風

    viernes, 25 de mayo de 2012 7:04
  • Hi Spidarman,

    with a selection you can try this

    .Font.FontStyle = "Bold"

    HTH Paolo

    • Marcado como respuesta 沈世鈞 viernes, 25 de mayo de 2012 7:43
    viernes, 25 de mayo de 2012 7:18