Propósito

✔ Programação GLOBAL® - Quaisquer soluções e/ou desenvolvimento de aplicações pessoais, ou da empresa, que não constem neste Blog devem ser tratados como consultoria freelance. Queiram contatar-nos: brazilsalesforceeffectiveness@gmail.com | ESTE BLOG NÃO SE RESPONSABILIZA POR QUAISQUER DANOS PROVENIENTES DO USO DOS CÓDIGOS AQUI POSTADOS EM APLICAÇÕES PESSOAIS OU DE TERCEIROS.

.: Vitrine

Carregando artigos...

Views

Mostrando postagens com marcador font. Mostrar todas as postagens
Mostrando postagens com marcador font. Mostrar todas as postagens

VBA Excel Basic - Como mudar a Cor e o Tamanho da Fonte em um Range- How To Change The Font Color And Font Size Of A Particular Range



Sim, mais tópicos voltados para quem está iniciando na utilização do VBA - Visual Basic for Application.

Que tal aprender a mudar a Cor e o Tamanho das fontes usados num Range?

SSub sbExample4()
    'Pode usar a propriedade Interior.ColorIndex
    Range("B1:B10").Font.ColorIndex = 3 ' 3=Red
End Sub


brazilsalesforceeffectiveness@gmail.com

✔ Brazil SFE®Author´s Profile  Google+   Author´s Professional Profile   Pinterest   Author´s Tweets

VBA Powerpoint - Mesmas Fontes e Cores

Inline image 1

Este código salvará a sua pelo quando alguém lhe entregar uma apresentação totalmente fora do layout usado na sua empresa.

Ao invés de precisar alterar cada slide da apresentação, este código fará isso para você.

Sub allchange()
Dim osld As Slide, oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoPlaceholder Then
'Title text change values as required
If oshp.PlaceholderFormat.Type = 1 Or oshp.PlaceholderFormat.Type = 3 Then
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
With oshp.TextFrame.TextRange.Font
.Name = "Arial"
.Size = 36
.Color.RGB = RGB(0, 0, 255)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
End If
End If
If oshp.PlaceholderFormat.Type = 2 Or oshp.PlaceholderFormat.Type = 7 Then
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
'Body text change values as required
With oshp.TextFrame.TextRange.Font
.Name = "Arial"
.Size = 24
.Color.RGB = RGB(255, 0, 0)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
End If
End If
End If
Next oshp
Next osld
End Sub


Deixe os seus comentários! Envie este artigo, divulgue este link na sua rede social...


Tags: VBA, Powerpint, Font, Color,


VBA Excel - Ajuste o layout de diversas planilhas - Loop through all worksheets in all Excel workbooks in a folder to change the font, font size, and alignment of text in all cells



Gosto muito de automatizar os processos que envolvem a repetição e o retrabalho humano. Isso poupa muito tempo e dinheiro. Gastar tempo automatizando um processo é algo realmente recompensador.

Ao gerarmos diversos relatórios em planilhas diferentes (workbook) do MS Excel, não queremos perder tempo formatando-as durante a geração e processamento de tais dados. Mas podemos programar para que sejam minimamente formatadas depois que tudo terminar e todos os arquivos estiverem gravados em uma pasta do nosso servidor ou estação de trabalho. Como?

Sub FormatLayoutFiles()
    Const fPath As String = "D:\Bernardes\Docs\"

    Dim sh As Worksheet
    Dim sName As String

    With Application
        Let .Calculation = xlCalculationManual
        Let .EnableEvents = False
        Let .ScreenUpdating = False
    End With

    Let sName = Dir(fPath & "*.xls*")

    Do Until sName = ""
        With GetObject(fPath & sName)
            For Each sh In .Worksheets
                With sh
                    Let .Cells.HorizontalAlignment = xlLeft
                    Let .Cells.Font.Name = "Arial"
                    Let .Cells.Font.Size = 10
                End With
            Next sh
            .Close True
        End With

        Let sName = Dir
    Loop

    With Application
        Let .Calculation = xlAutomatic
        Let .EnableEvents = True
        Let .ScreenUpdating = True
    End With
End Sub


Tags: Excel, VBA, format, layout, fomatação, Loop, worksheets, workbooks, folder,change, font, font size, alignment, text, cells


VBA Excel - Liste todas as Fontes instaladas no MS Excel - Display all installed fonts using VBA in Microsoft Excel



Sim, é possível listar todas as fontes que estiverem instaladas no seu computador. Como?

Use o código abaixo:

Sub ShowInstalledFonts()
Const StartRow As Integer = 4
Dim FontNamesCtrl As CommandBarControl, FontCmdBar As CommandBar, tFormula As String
Dim fontName As String, i As Long, fontCount As Long, fontSize As Integer
    fontSize = 0
    fontSize = Application.InputBox("Enter Sample Font Size Between 8 And 30", _
         "Select Sample Font Size", 12, , , , , 1)
    If fontSize = 0 Then Exit Sub
    If fontSize < 8 Then fontSize = 8
    If fontSize > 30 Then fontSize = 30
    Set FontNamesCtrl = Application.CommandBars("Formatting").FindControl(ID:=1728)
    ' If Font control is missing, create a temp CommandBar
    If FontNamesCtrl Is Nothing Then
        Set FontCmdBar = Application.CommandBars.Add("TempFontNamesCtrl", _
            msoBarFloating, False, True)
        Set FontNamesCtrl = FontCmdBar.Controls.Add(ID:=1728)
    End If
    Application.ScreenUpdating = False
    fontCount = FontNamesCtrl.ListCount
    Workbooks.Add
    ' list font names in column A and font example in column B
    For i = 0 To FontNamesCtrl.ListCount - 1
        fontName = FontNamesCtrl.List(i + 1)
        Application.StatusBar = "Listing font " & _
            Format(i / (fontCount - 1), "0 %") & " " & _
            fontName & "..."
        Cells(i + StartRow, 1).Formula = fontName
        With Cells(i + StartRow, 2)
            tFormula = "abcdefghijklmnopqrstuvwxyz"
            If Application.International(xlCountrySetting) = 47 Then
                tFormula = tFormula & "æøå"
            End If
            tFormula = tFormula & UCase(tFormula)
            tFormula = tFormula & "1234567890"
            .Formula = tFormula
            .Font.Name = fontName
        End With
    Next i
    Application.StatusBar = False
    If Not FontCmdBar Is Nothing Then FontCmdBar.Delete
    Set FontCmdBar = Nothing
    Set FontNamesCtrl = Nothing
    ' add heading
    Columns(1).AutoFit
    With Range("A1")
        .Formula = "Installed fonts:"
        .Font.Bold = True
        .Font.Size = 14
    End With
    With Range("A3")
        .Formula = "Font Name:"
        .Font.Bold = True
        .Font.Size = 12
    End With
    With Range("B3")
        .Formula = "Font Example:"
        .Font.Bold = True
        .Font.Size = 12
    End With
    With Range("B" & StartRow & ":B" & _
        StartRow + fontCount)
        .Font.Size = fontSize
    End With
    With Range("A" & StartRow & ":B" & _
        StartRow + fontCount)
        .VerticalAlignment = xlVAlignCenter
    End With
    Range("A4").Select
    ActiveWindow.FreezePanes = True
    Range("A2").Select
    ActiveWorkbook.Saved = True
End Sub



Tags: VBA, Tips, Excel, Font, Fontes, install, instaladas




VBA Excel Tips - Mude a Fonte de todas as Células com Comentários - Change font on all cell comments

Inline image 1
Eu sei que este é um exemplo simples, mas de exemplos simples também se vive, certo?

Este exemplo mostra uma funcionalidade que pode ser muito útil ao alterarmos os diversos comentários postados em dezenas de células dentro das nossas Planilhas, Dashboards, e Scorecards.

Poderemos mudar o tamanho, tipo, cor e tudo o mais que estiver comentado dentro das células.

Sub ChangeCommentsFont() 

    Dim cmt As Comment 

    For Each cmt In ActiveSheet.Comments 

        With cmt.Shape.TextFrame.Characters.Font 

            Let .Size = 11 

        End With 

    Next cmt 

End Sub

Tags: VBA, Excel, Tips, cell, comments, font, fonte, comentário, célula,



VBA Powerpoint - Altere todas as Fontes da apresentação - Change Font for Whole Presentation

powerpoint-header.jpg

Pois é, mais um script para o MS Powerpoint.

Este VBA poderá salvar sua vida quando alguém fiizer uma apresentação com estilos de fontes com as respectivas cores diferentes em cada página e, por não ter acesso ao Slide Mestre, precise mudar em cada Slide. Imagine! Precisar alterar os valores dos nomes das fontes, seus tamanhos e valores RGBs para os títulos e corpos de texto e talvez definir se serão Negrito e/ou Itálico.

Sub ChangeAllObj()
Dim osld As Slide, oshp As Shape

For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes

If oshp.Type = msoPlaceholder Then
'Title text change values as required
If oshp.PlaceholderFormat.Type = 1 Or oshp.PlaceholderFormat.Type = 3 Then
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
With oshp.TextFrame.TextRange.Font
.Name = "Arial"
.Size = 36
.Color.RGB = RGB(0, 0, 255)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
End If
End If

If oshp.PlaceholderFormat.Type = 2 Or oshp.PlaceholderFormat.Type = 7 Then
If oshp.HasTextFrame Then
If oshp.TextFrame.HasText Then
'Body text change values as required
With oshp.TextFrame.TextRange.Font
.Name = "Arial"
.Size = 24
.Color.RGB = RGB(255, 0, 0)
.Bold = msoFalse
.Italic = msoFalse
.Shadow = False
End With
End If
End If
End If
End If
Next oshp
Next osld
End Sub





Tags: Powerpoint, Slide, UDF, fontes, mudar, objeto, font, change, presentation, RGB, color

André Luiz Bernardes
A&A® - Work smart, not hard.




diHITT - Notícias