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 texto. Mostrar todas as postagens
Mostrando postagens com marcador texto. Mostrar todas as postagens

PIECE OF CAKE - Criando Arquivo Texto Externo



#A&A #PIECEOFCAKE #POC #VBA


Criar arquivos texto externos a aplicação que trabalhamos é um recurso muito usado, especialmente quando queremos registrar algum log de acesso.

O código abaixo é muito funcional, quando passamos os dados que serão o conteúdo do arquivo.

Function CreateAfile(PathFileNameExt As String, nFrase As String)
    ' © 2007-20 Alefe & Bete Processamento de Dados LTDA - ME, except where noted, all rights reserved.
    '      Author: André Bernardes
    '     Contact: andreluizbernardess@gmail.com | https://goo.gl/EUMbSe/
    ' Description: Cria uma nova aba

    Dim fs, a
    
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set a = fs.CreateTextFile(PathFileNameExt, True)

    a.WriteLine (nFrase)

    a.Close

End Function

Consulte-nos

⬛◼◾▪ Social Media ▪◾◼⬛
• FACEBOOK • TWITTER • INSTAGRAM • TUMBLR • GOOGLE+ • LINKEDIN • PINTEREST

⬛◼◾▪ Blogs ▪◾◼⬛ 


⬛◼◾▪ CONTATO ▪

PIECE OF CAKE - Convertendo Texto em Imagem - Convert Text to an Image using the VBA Windows API


Nesta época de Mídias Sociais e grande necessidade de publicarmos KPIs e Dashboards com insights baseados em informações atualizadas, termos uma solução como a demonstrada abaixo será muito útil no dia a dia.

Sub PublishExcelRangeAsImage (r As Excel.Range, stFileNamePathForImage As String, Optional stImageType = "BMP")
 '
 ' Copies a range in Excel, converts it to a picture, and saves it as an image file.
 ' r = The range you want to copy and convert to an image.
 ' stFileNamePathForImage = Full path, without the period (.) and extension of the destination file.
 ' stImageType = The extension for the filename; also determines the type of image saved to disk.
 ' stImageType can be "bmp", "gif", or "jpg". "bmp" is default.
 '
 Dim c As Excel.Chart
 Dim wsSave
 Dim wbSave As Excel.Workbook
 Dim fDisplayAlerts As Boolean

 stImageType = UCase(stImageType)
 '
 ' In case another Workbook is active, save it so we can restore it when we are done.
 ' We need to do this because, later, we will change the active sheet to a chart.
 '
 Set wbSave = Excel.ActiveWorkbook
 Set wsSave = wbSave.ActiveSheet
 '
 ' Create a temporary chart object. This is where the image will be created.
 '
 Set c = r.Worksheet.Parent.Charts.Add
 '
 ' In Excel 2007, a new chart is no lonter empty; therefore, clear it.
 '
 c.ChartArea.Clear

 c.ChartArea.Height = r.Height * 2 ' Make sure the ChartArea is bigger than
 c.ChartArea.Width = r.Width * 2 ' the image, or image will be made smaller
 '
 ' Copy the image from the range object to the chart.
 '
 r.CopyPicture xlScreen, xlBitmap
 c.Paste
 '
 ' Position the image, as Excel doesn't do this well on it's own.
 ' Note, since we cleared the chart before pasting the image,
 ' we can be sure that the image is the only shape on the chart.
 ' Thus, we are safe to directly address shape 1, from the shape
 ' collection and know it's the image.
 '
 Let c.Shapes(1).Left = 0
 Let c.Shapes(1).Top = 0
 Let c.Shapes(1).Height = r.Height
 Let c.Shapes(1).Width = r.Width
 '
 ' Prevent the image from resizing when we resize the chart.
 '
 Let c.Shapes(1).Placement = xlFreeFloating
 '
 ' Now make the chart the same size as the image.
 '
 ' We need to activate the chart first because of a timing issue. If we don't
 ' activate it, the code fails when we set the height, unless we put a delay into the code.
 ' Better to activate it than put in a delay.
 '
 c.Activate
 Let c.ChartArea.Height = r.Height
 Let c.ChartArea.Width = r.Width
 '
 ' Save the image as a file.
 '
 c.Export stFileNamePathForImage & "." & stImageType, stImageType
 '
 ' We are done. Delete the chart. Note, we first need to turn off alerts, or else,
 ' Excel prompts us to make sure we really want to delete it.
 '
 Let fDisplayAlerts = Application.DisplayAlerts
 Let Application.DisplayAlerts = False
 c.Delete
 Let Application.DisplayAlerts = fDisplayAlerts

 Set c = Nothing
 '
 ' Return focus back to the original workbook/worksheet that was active
 ' when this code began.
 '
 wsSave.Activate

 Set wbSave = Nothing
 Set wsSave = Nothing

End Sub


#A&A #API #Converter #Dashboard #Imagem #KPI #PIECEOFCAKE #Text #Texto #WindowsAPI #POC #VBA 


Defina a Latitude e a Longitude - Find Latitude and Longitude of any address using Google Map API and VBA


VBA Excel - Traduzindo Planilhas - MS Excel VBA Script to Translate worksheets using the Google Translate API
VBA Excel - Traduzindo Planilhas - MS Excel VBA Script to Translate worksheets using the Google Translate API

Excel - Manipule o Google Maps em sua Planilha - Put a Google Map in your Spreadsheet
Excel - Manipule o Google Maps em sua Planilha - Put a Google Map in your Spreadsheet

Convertendo Texto em Imagem - Convert Text to an Image using the VBA Windows API
Convertendo Texto em Imagem - Convert Text to an Image using the VBA Windows API

Correção de Métricas - For Subscripts, Superscripts and Common Typos
Correção de Métricas - For Subscripts, Superscripts and Common Typos

MS Access - Cinco Formas Manuais de Reparo
MS Access - Cinco Formas Manuais de Reparo

MS Access e MS Word - Técnica de Automação
MS Access e MS Word - Técnica de Automação

Microsoft Access - Removendo Prefixo das Tabelas
Microsoft Access - Removendo Prefixo das Tabelas

Sempre Use Stored Procedures - Always Use Stored Procedures
Sempre Use Stored Procedures - Always Use Stored Procedures

A&A - Dados ou Informações?
A&A - Dados ou Informações?

Consulte-nos

⬛◼◾▪ Social Media ▪◾◼⬛
• FACEBOOK • TWITTER • INSTAGRAM • TUMBLR • GOOGLE+ • LINKEDIN • PINTEREST

⬛◼◾▪ Blogs ▪◾◼⬛ 


⬛◼◾▪ CONTATO ▪

VBA Word - Formatando o Texto

VBA Word - Formatando o Texto



With Selection.Font
' the Latin text font name and size...   
        .Name = "Verdana"
        .Size = 12
' Bold and Italic are the Font Style...        
        .Bold = False
        .Italic = False
        .Underline = wdUnderlineNone
        .UnderlineColor = wdColorAutomatic
' The following are the font effects...       
        .StrikeThrough = False
        .DoubleStrikeThrough = False
        .Outline = False
        .Emboss = False
        .Shadow = False
        .Hidden = False
        .SmallCaps = True
        .AllCaps = False
        .Color = wdColorAutomatic
        .Engrave = False
        .Superscript = False
        .Subscript = False
' Character spacing...
        .Spacing = -1
        .Scaling = 100
        .Position = -2
        .Kerning = 12
' One of the available Annimation effects.
' Can be one of the following...
' wdAnimationBlinkingBackground
' wdAnimationLasVegasLights
' wdAnimationMarchingBlackAnts
' wdAnimationMarchingRedAnts
' wdAnimationShimmer
' wdAnimationSparkleText
' wdAnimationSparkleText
        .Animation = wdAnimationNone
The font, size, and style of Bidirectional fonts.       
        .SizeBi = 12
        .NameBi = "Tahoma"
        .BoldBi = False
        .ItalicBi = False
    End With



Envie seus comentários
 e sugestões e compartilhe este artigo!

brazilsalesforceeffectiveness@gmail.com

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


DONUT PROJECT 2014 - VBA - Excel - Importando arquivos CSV

DONUT PROJECT 2014 - VBA - Excel - Importando arquivos CSV



Importar dados de arquivos CSVs é algo tão comum, que o MS Excel já tem um mecanismo próprio para fazer isso. Mas esta continua sendo uma das dúvidas mais comuns. Como fazer essa importação, através do VBA?



Uma alternativa é a de ler o arquivo CSV como se fosse um arquivo texto, e em seguida carregar cada linha em uma matriz, e através de loops inserí-los no MS Excel.

'This sub only provides the sub ImportCSVfile with parameters

Sub InitiateImportCSVFile()
        Dim filePath As String
        Dim ImportToRow As Integer
        Dim StartColumn As Integer      

        Let filePath = "E:\Bernardes\Arquivo.csv"
        Let ImportToRow = 1 'the row where it will start printing
        Let StartColumn = 1 'the start column

        ImportCSVFile filePath, ImportToRow, StartColumn
End Sub

'  Este é o código que faz todo o trabalho:

Sub ImportCSVFile 
(ByVal filePath As String, ByVal ImportToRow As Integer, ByVal StartColumn As Integer) 

    Dim line As String
    Dim arrayOfElements
    Dim element As Variant

    Open filePath For Input As #1 ' Open file for input

        Do While Not EOF(1) ' Loop until end of file

            ImportToRow = ImportToRow + 1

            Line Input #1, line

            Let arrayOfElements = Split(line, ";") 'Split the line into the array.          

            ' Loop thorugh every element in the array and print to Excelfile

            For Each element In arrayOfElements

                Let Cells(ImportToRow, StartColumn).Value = element

                Let StartColumn = StartColumn + 1

            Next

        Loop

    Close #1 ' Close file.
End Sub


 Série de Livros nut Project 

DONUT PROJECT: VBA - Projetos e Códigos de Visual Basic for Applications (Visual Basic For Apllication)eBook - DONUT PROJECT 2024 - Volume 03 - Funções Financeiras - André Luiz Bernardes eBook - DONUT PROJECT 2024 - Volume 02 - Conectando Banco de Dados - André Luiz Bernardes eBook - DONUT PROJECT 2024 - Volume 01 - André Luiz Bernardes




 Série VBA Outlook: 

VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Usando o DAO em vez do ADO (Using DAO instead of ADO) VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Usando um Recordset Desconectado (Using a Disconnected Recordset) VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Usando Transações (Using Transactions)


VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Usando Parâmetros em Consultas SQL (Using Parameters in SQL Queries) VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Tratando Erros (Handling Errors) VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Fechando a Conexão (Closing the Connection)


VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Enviando um e-Mail para cada Cliente (Sending an email to each Customer) VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Lendo Dados do Conjunto de Registros (Reading Recordset Data) VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Executando uma Consulta SQL (Executing an SQL Query)


VBA Outlook - Usando o VBA no Outlook - Using Visual Basic for Applications in Outlook - Conectando ao Banco de Dados usando ADO (Connecting to the Database using ADO)


 Série DONUT PROJECT 2024 

DONUT PROJECT 2024 - VBA - Retorna o Valor do Conteúdo da Área de Transferência do Sistema DONUT PROJECT 2024 - VBA - Retorna a Versão do Sistema Operacional em que o Excel está sendo Executado DONUT PROJECT 2024 - VBA - Desenvolvimento de Ferramentas de Análise de Riscos

DONUT PROJECT 2024 - VBA - Desenvolvimento Obter Informações sobre a Versão do Sistema Operacional DONUT PROJECT 2024 - VBA - Automatizando Tarefas de Engenharia e Design DONUT PROJECT 2024 - VBA - Automatização de Processos de Medir Distâncias no Google Maps

DONUT PROJECT 2024 - VBA - Automatização de Processos de Marketing Mail com o GMail DONUT PROJECT 2024 - VBA - Automatização de Processos de Marketing Mail DONUT PROJECT 2024 - VBA - Como proteger e ocultar fórmulas em uma planilha do Excel usando VBA

DONUT PROJECT 2024 - VBA - Código Exporta os dados e Atualiza as Quantidades em Estoque de um Determinado Produto na Planilha "Estoque" Crie Funções Personalizadas com Visual Basic for Applications (VBA) para Análise de Dados nos Negócios Saber programar em Visual Basic for Applications (VBA)



 Série DONUT PROJECT 2021 


DONUT PROJECT 2021 - VBA Function: Sabe como enviar dados para o Google Sheet, através do MS Excel, usando VBA, no MacBook?

DONUT PROJECT 2021 - VBA Function:  Como Rastrear o Google Maps (Coordenadas Geográficas) no VBA Excel? DONUT PROJECT 2021 - VBA Function:  Crie Acrônimos a partir de Strings de Texto DONUT PROJECT 2021 - VBA Function:  Convertendo uma Matrix num Vetor - Convert Matrix to a Vector

DONUT PROJECT 2021 - VBA Function:  Como tornar o Formulário Transparente no MS Excel? DONUT PROJECT 2021 - VBA Function:  Faça Buscas no Google a Partir da Célula do MS Excel - Search Google From a Cell DONUT PROJECT 2021 - VBA Function:  Decompondo um Nome nas Dimensões de uma Matriz


DONUT PROJECT 2021 - VBA Function: Extraindo o Último Sobrenome de um Nome Completo ou a Última Palavra de uma Frase DONUT PROJECT 2021 - VBA Function:  Extraindo o Segundo Nome de um Nome Completo ou a Segunda Palavra de uma Frase DONUT PROJECT 2021 - VBA Function: Extraindo o Primeiro Nome ou  a Primeira Palavra de uma Frase



 Série DONUT PROJECT 2018 

DONUT PROJECT 2018 - VBA - 12 - Aumente sua Produtividade DONUT PROJECT 2018 - VBA - 10 - Loop For-Each DONUT PROJECT 2018 - VBA - 08 - Referenciando Ranges


DONUT PROJECT 2018 - VBA - 07 - Amostra de Macro  DONUT PROJECT 2018 - VBA - 06 - Recursos Adicionais DONUT PROJECT 2018 - VBA - 05 - Gravando a Primeira Macro

DONUT PROJECT 2018 - VBA - 04 - Opções de Solução DONUT PROJECT 2018 - VBA - 03 - Requisitos e Preparação DONUT PROJECT 2018 - VBA - 02 - Continua Cético

DONUT PROJECT 2018 - VBA - 01 - Maximizando Sua Eficiência DONUT PROJECT 2018 - Excel - Ao Gravar Macro Altere o Método SELECT por RANGE 


 DONUT PROJECT 2018 - Excel - Acelerando as Macros - Desativando os Recursos de Atualização



 Série DONUT PROJECT 2015 

DONUT PROJECT 2015 - Excel - Formatting A Pivot Field's Data - Formatando os Campos de uma Tabela Dinâmica DONUT PROJECT 2015 - Excel - Formatting A Pivot Table's Data - Formatando os Dados de um Tabela Dinâmica DONUT PROJECT 2015 - Excel - Expand/Collapse Entire Field Detail - Ampliando Detalhadamente os Campos da Tabela Dinâmica

DONUT PROJECT 2015 - Extraindo e-Mails - Extracting An Email Address From Text   DONUT PROJECT 2015 - Função - Extraindo Quaisquer Elementos de uma String a Partir do Limitador DONUT PROJECT 2015 - Função - Retorna o número de ocorrências de um caracter numa string

DONUT PROJECT 2015 - Função - Retorna Qualquer Conteúdo Delimitado por 2 Caracteres  DONUT PROJECT 2015 - Função - Retorna Apenas o Conteúdo Entre Parênteses DONUT PROJECT 2015 - Função - Extrai Conteúdo entre Parênteses

DONUT PROJECT 2015 - Excel - Report Layout DONUT PROJECT 2015 - Excel - Grand Totals - Inserindo Totais para todas as Colunas e Linhas na Tabela Dinâmica DONUT PROJECT 2015 - Excel - Change Pivot Table Data Source Range - Mudando a Fonte de Dados da Tabela Dinâmica

DONUT PROJECT 2015 - Excel - Refresh Pivot Tables - Aplicando Refresh em Tabelas Dinâmicas DONUT PROJECT 2015 - How To Create Partially Anonymous Data - Como Manter Informações parcialmente Anônimas  DONUT PROJECT 2015 - Excel - Clear Report Filter - Limpando o Filtro da Tabela Dinâmica

DONUT PROJECT 2015 - Excel - Report Filter On Multiple Items - Criando Filtros Múltiplos na Tabela Dinâmica DONUT PROJECT 2015 - Excel - Report Filter On A Single Item - Criando Filtro de Relatório na Tabela Dinâmica DONUT PROJECT 2015 - Excel - Remove Calculated Pivot Fields - Removendo Campos Calculados da Tabela Dinâmica

DONUT PROJECT 2015 - Excel - Remove Pivot Fields - Removendo Campos da Tabela Dinâmica  DONUT PROJECT 2015 - Excel - Add A Values Field - Adicionando Campos Calculados na Tabela Dinâmica DONUT PROJECT 2015 - Excel - Add Calculated Pivot Fields - Adicionando Campos Calculados na Tabela Dinâmica

DONUT PROJECT 2015 - Excel - Add Pivot Fields - Adicionado Campos na Tabela Dinâmica DONUT PROJECT 2015 - Excel - Delete All Pivot Tables - Apagando todas as Tabelas Dinâmicas DONUT PROJECT 2015 - Excel - Delete A Specific Pivot Table - Apague um Tabela Dinâmica Específica


DONUT PROJECT 2015 - VBA To Add A Confidentiality Footer Statement In Excel, Word, or PowerPoint - Adicionando um Rodapé com Status de Confidencialidade no Excel, Word ou PowerPoint DONUT PROJECT 2015 - Excel - Create A Pivot Table - Criando uma Tabela Dinâmica


 Série DONUT PROJECT 2014 

DONUT PROJECT 2014 - Use os add-ins do MS Excel e dê um salto em sua performance DONUT PROJECT 2014 - VBA - Automatizando o Outlook para enviar um e-mail com anexo  DONUT PROJECT 2014 - VBA - Outlook - Salvando todos os arquivos anexados nos e-mails


DONUT PROJECT 2014 - VBA - Criando uma Matriz de Datas MAT - Moving Annual Total  DONUT PROJECT 2014 - VBA - Excel - Atualizando Tabelas Dinâmicas - Refresh Pivot Table via VBA DONUT PROJECT 2014 - VBA - Excel - Removendo os Caracteres Alfabéticos e Especiais


DONUT PROJECT 2014 - VBA - Access - Criando uma Query com Parâmetros DONUT PROJECT 2014 - VBA - Access - Atualizando o conteúdo de uma Query DONUT PROJECT 2014 - VBA - Access - Saiba o Número de Registro de cada tabela


DONUT PROJECT 2014 - VBA - Access - Extraia Blocos de Dados do Banco de Dados - Sem Problemas de TIMEOUT DONUT PROJECT 2014 - VBA - Access - Lista o Tamanho de Todas as Tabelas DONUT PROJECT 2014 - VBA - Excel - Populando um ListBox no seu Formulário

DONUT PROJECT 2014 - VBA - Excel - Importando arquivos CSV  DONUT PROJECT 2014 - VBA - Excel - Deletando Conexões de Dados  DONUT PROJECT 2014 - VBA - Excel - Obtendo o Nome da Planilha sem a Extensão - Get name of workbook without extension


DONUT PROJECT 2014 - VBA - WORD - Exportação Automatizada - De *.docx Para *.pdf - Otimizando o tamanho


  Clique aqui e nos contate via What's App para avaliarmos seus projetos 

Envie seus comentários e sugestões e compartilhe este artigo!
brazilsalesforceeffectiveness@gmail.com

Inline image 1


diHITT - Notícias