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.

VBA Access: Lista de Livros

VBA Access: Lista de Livros


É muito bom quando temos acesso a um grande acervo de informações que poderão enriquecer o nosso conhecimento técnico, ampliando enormemente a nossa visão pessoal sobre determinada aplicação. Esse é o objetivo ao listar aqui alguns títulos interessantes sobre o universo do VBA para o Microsoft Office Access.

 Sybase's PROCs 

Exemplo Básico de Execução de Stored Procedure

Espero que gostem dos títulos, bem como acrescentem outros para o aprendizado de todos.


Access 2000 VBA Handbook by Susann Novalis
Access 2003 Programming by Example with VBA, XML, and ASP by Julitta Korol
Access 2003 VBA Programmer's Reference (Programmer to Programmer) by Patricia Cardoza, Teresa Hennig, Graham Seach, and Armen Stein
Access 2007 VBA Bible: For Data-Centric Microsoft Office Applications by Helen Feddema
Access 2007 VBA Programmer's Reference (Programmer to Programmer) by Teresa Hennig, Rob Cooper, Geoffrey L. Griffith, and Armen Stein
Access 2007 VBA Programming For Dummies (For Dummies (Computer/Tech)) by Joseph C. Stockman and Alan Simpson
Access 2007: The Missing Manual by Matthew MacDonald
Access Cookbook - Paul Litwin, Ken Getz, Andy Baron
Access VBA Programming by Charles E. Brown and Ron Petrusha
Access VBA Programming For Dummies (For Dummies (Computer/Tech)) by Alan Simpson
Alison Balter's Mastering Microsoft Office Access 2007 Development (Sams) by Alison Balter
Automating Microsoft Access with VBA (Business Solutions) by Mike Gunderloy and Susan Sales Harkins
Beginning Access 2000 VBA by Robert Smith and Dave Sussman
Beginning Access 2003 VBA by Denise M. Gosnell
Building Microsoft Access Applications - John L. Viescas
Database Design for Mere Mortals, Second Edition - Michael J. Hernandez
F. Scott Barker's Microsoft Access 2002 Power Programming by F. Scott Barker
Handbook of Relational Database Design - Candace C. Fleming, Barbara Vonhalle
Inside Microsoft SQL Server 2005: T-SQL Programming - Itzik Ben-gan, Dejan Sarka, and Roger Wolter
Integrating Excel and Access by Michael Schmalz
Joe Celko's SQL for Smarties: Advanced SQL Programming - Joe Celko
Joe Celko's SQL Puzzles and Answers - Joe Celko
Learn Access 2003 VBA With The Smart Method by Mike Smart
Microsoft Access Visual Basic Step By Step - Evan Callahan
Microsoft Access Data Analysis: Unleashing the Analytical Power of Access by Michael Alexander
Microsoft Access Developer's Guide to SQL Server - Mary Chipman and Andy Baron
Microsoft Access VBA Programming for the Absolute Beginner, Third Edition by Michael Vine
Microsoft Office Access 2003 Inside Out - John L. Viescas
Microsoft Office Access 2007 Forms, Reports, and Queries (Business Solutions) by Paul McFedries
Microsoft Office Access 2007 Inside Out - John L. Viescas, Jeff Conrad
Microsoft Office Access 2007 VBA (Business Solutions) by Scott B. Diamond and Brent Spaulding
Microsoft® Office Access 2003 Inside Out (Microsoft Office Access Inside Out) by John L. Viescas
Microsoft® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out) by John Viescas and Jeff Conrad
Microsoft® Office Access(TM) 2007 Step by Step (Step By Step (Microsoft)) by Steve Lambert and M Dow Lambert
New Perspectives on Microsoft Office Access 2007, Comprehensive by Joseph J. Adamski and Kathy T. Finnegan
Office VBA Macros You Can Use Today: Over 100 Amazing Ways to Automate Word, Excel, PowerPoint, Outlook, and Access by Juan Pablo Gonzalez, Cindy Meister, Suat Ozgur, and Bill Dilworth
Pro Access 2007 by Martin WP Reid
Relational Database Design Clearly Explained - Jan L. Harrington
Sams Teach Yourself Microsoft Access 2002 Programming in 24 Hours by Paul Kimmel
SQL Queries for Mere Mortals, 2nd Edition - John L. Viescas, Michael J. Hernandez
The Rational Guide to Microsoft Office Access 2007 Templates (Rational Guides) by Zac Woodall
VBA Developers Handbook - Ken Getz, Michael Gilbert



 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


 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


 PUDIM PROJECT 

eBook - PT - PUDIM PROJECT 2024 - Python Volume 01 - Funções Essenciais - Série PUDIM PROJECT — André Luiz Bernardes eBook - PT - PUDIM PROJECT 2024 - Python Volume 02 - Funções Essenciais - Série PUDIM PROJECT — André Luiz Bernardes eBook - PT - PUDIM PROJECT 2024 - Python Volume 03 - Automatizando Postagens em Redes e Plataformas Sociais - Série PUDIM PROJECT — André Luiz Bernardes


eBook - PT - PUDIM PROJECT 2024 - Python Volume 04 - Funções para Automatização - Série PUDIM PROJECT — André Luiz Bernardes eBook - PT - PUDIM PROJECT 2024 - Python Volume 05 - Automatizando Postagens em Redes e Plataformas Sociais - Série PUDIM PROJECT — André Luiz Bernardes eBook - PT - PUDIM PROJECT 2024 - Python Volume 06 - Automatizando Postagens em Redes e Plataformas Sociais - Série PUDIM PROJECT — André Luiz Bernardes


eBook - PT - PUDIM PROJECT 2024 - Python Volume 07 - Automatizando Postagens em Redes e Plataformas Sociais - Série PUDIM PROJECT — André Luiz Bernardes eBook - PT - PUDIM PROJECT 2024 - Python Volume 08 - Automatizando Postagens em Redes e Plataformas Sociais - Série PUDIM PROJECT — André Luiz Bernardes eBook - PT - PUDIM PROJECT 2024 - Python Volume 09 - Automatizando Postagens em Redes e Plataformas Sociais - Série PUDIM PROJECT — André Luiz Bernardes


eBook - PT - PUDIM PROJECT 2024 - Python Volume 10 - Automatizando Postagens em Redes e Plataformas Sociais - Série PUDIM PROJECT — André Luiz Bernardes eBook - PT - PUDIM PROJECT 2024 - Python Volume 11 - Automatizando Postagens em Redes e Plataformas Sociais - Série PUDIM PROJECT — André Luiz Bernardes

VBA: Boa definição ao pedir ajuda.

Constantemente nos deparamos com pedidos de ajuda em fóruns pela Internet a fora. Algo a que todos os que precisam de ajuda precisam considerar como um ponto importantíssimo é a definição. A descrição do que deseja, esta precisa ser lógica, coerente e descrita com o mínimo de detalhes pertinentes. Por quê: Bem, os que procuram ajuda precisam saber que perguntas e questões mal formuladas são ignoradas e passadas por alto por todos, pois são consideradas questões confusas, ineficientes e péssimamente redigidas. Então, caso deseje ser atendido e de forma rápida, seria apropriado considerar as sugestões que comento abaixo. Descrevendo: É verdade que a maioria dos que solicitam ajuda sequer têm noções de análise e programação, todavia, é bom informar a todos (e relembrar a alguns), que uma boa definição do que se deseja ajuda em muito o resultado esperado. Prenda-se as sugestões a seguir e então complete com a sua visão pessoal: (1) - Primeiramente, faça questão de descrever, com o máximo de detalhes possível, o que deseja; (2) - Em seguida descreva de modo direto e com sentido como deseja; (3) - Caso tenha parte da solução pronta, tome tempo para descrever o que já desenvolveu e até onde a sua solução atende a sua necessidade. Deixe claro quais são os pontos onde precisará de ajuda; (4) - Outro aspecto relevante é não misturar as soluções com recursos funcionais do próprio MS Excel, com soluções possíveis apenas com VBA. Tente discernir o que precisa e como precisa. Tomando alguns destes ou todos este cuidados, provavelmente contribuirá para tornar mais claro o seu problema e inspirará melhor aqueles que poderão ajudá-lo. André Luiz Bernardes http://al-bernardes.sites.uol.com.br/

Outlook: Enviando E-mail sem o aviso de segurança


Esta tem sido a necessidade e a reclamação de muitos. Como enviar mensagens diretamente do Word, Excel sem que o Outlook fique com aquela mensagem cuidando da nossa vida?

PASSOS:
  1. Abra o Outlook
  2. Vá até o Menu |Tools | Macro | Visual Basic Editor
  3. No ambiente de VBA expanda o projeto que estiver no nó (geralmente é 'Project1')
  4. Ache e abra o módulo "ThisOutLookSession" (Abre com um duplo clique)
  5. Copie e cole o código abaixo:
Option Explicit

' Code: Send E-mail without Security Warnings
' OUTLOOK 2003 VBA CODE FOR 'ThisOutlookSession' MODULE
' (c) 2005 Wayne Phillips (http://www.everythingaccess.com)
' Written 07/05/2005
' Last updated v1.4 - 26/03/2008
'
' Please read the full tutorial here:
' http://www.everythingaccess.com/tutorials.asp?ID=Outlook-Send-E-mail-without-Security-Warning
'
' Please leave the copyright notices in place - Thank you.

Private Sub Application_Startup()

'IGNORE - This forces the VBA project to open and be accessible using automation
' at any point after startup

End Sub

' FnSendMailSafe
' --------------
' Simply sends an e-mail using Outlook/Simple MAPI.
' Calling this function by Automation will prevent the warnings
' 'A program is trying to send a mesage on your behalf...'
' Also features optional HTML message body and attachments by file path.
'
' The To/CC/BCC/Attachments function parameters can contain multiple items by seperating
' them by a semicolon. (e.g. for the strTo parameter, 'test@test.com; test2@test.com' is
' acceptable for sending to multiple recipients.
'
Public Function FnSendMailSafe(strTo As String, _
strCC As String, _
strBCC As String, _
strSubject As String, _
strMessageBody As String, _
Optional strAttachments As String) As Boolean

' (c) 2005 Wayne Phillips - Written 07/05/2005
' Last updated 26/03/2008 - Bugfix for empty recipient strings
' http://www.everythingaccess.com
'
' You are free to use this code within your application(s)
' as long as the copyright notice and this message remains intact.

On Error GoTo ErrorHandler:

Dim MAPISession As Outlook.NameSpace
Dim MAPIFolder As Outlook.MAPIFolder
Dim MAPIMailItem As Outlook.MailItem
Dim oRecipient As Outlook.Recipient

Dim TempArray() As String
Dim varArrayItem As Variant
Dim strEmailAddress As String
Dim strAttachmentPath As String

Dim blnSuccessful As Boolean

'Get the MAPI NameSpace object
Set MAPISession = Application.Session

If Not MAPISession Is Nothing Then

'Logon to the MAPI session
MAPISession.Logon , , True, False

'Create a pointer to the Outbox folder
Set MAPIFolder = MAPISession.GetDefaultFolder(olFolderOutbox)
If Not MAPIFolder Is Nothing Then

'Create a new mail item in the "Outbox" folder
Set MAPIMailItem = MAPIFolder.Items.Add(olMailItem)
If Not MAPIMailItem Is Nothing Then

With MAPIMailItem

'Create the recipients TO
TempArray = Split(strTo, ";")
For Each varArrayItem In TempArray

strEmailAddress = Trim(varArrayItem)
If Len(strEmailAddress) > 0 Then
Set oRecipient = .Recipients.Add(strEmailAddress)
oRecipient.Type = olTo
Set oRecipient = Nothing
End If

Next varArrayItem

'Create the recipients CC
TempArray = Split(strCC, ";")
For Each varArrayItem In TempArray

strEmailAddress = Trim(varArrayItem)
If Len(strEmailAddress) > 0 Then
Set oRecipient = .Recipients.Add(strEmailAddress)
oRecipient.Type = olCC
Set oRecipient = Nothing
End If

Next varArrayItem

'Create the recipients BCC
TempArray = Split(strBCC, ";")
For Each varArrayItem In TempArray

strEmailAddress = Trim(varArrayItem)
If Len(strEmailAddress) > 0 Then
Set oRecipient = .Recipients.Add(strEmailAddress)
oRecipient.Type = olBCC
Set oRecipient = Nothing
End If

Next varArrayItem

'Set the message SUBJECT
.Subject = strSubject

'Set the message BODY (HTML or plain text)
If StrComp(Left(strMessageBody, 6), "<HTML>", vbTextCompare) = 0 Then
.HTMLBody = strMessageBody
Else
.Body = strMessageBody
End If

'Add any specified attachments
TempArray = Split(strAttachments, ";")
For Each varArrayItem In TempArray

strAttachmentPath = Trim(varArrayItem)
If Len(strAttachmentPath) > 0 Then
.Attachments.Add strAttachmentPath
End If

Next varArrayItem

.Send 'No return value since the message will remain in the outbox if it fails to send

Set MAPIMailItem = Nothing

End With

End If

Set MAPIFolder = Nothing

End If

MAPISession.Logoff

End If

'If we got to here, then we shall assume everything went ok.
blnSuccessful = True

ExitRoutine:
Set MAPISession = Nothing
FnSendMailSafe = blnSuccessful

Exit Function

ErrorHandler:
MsgBox "An error has occured in the user defined Outlook VBA function FnSendMailSafe()" & vbCrLf & vbCrLf & _
"Error Number: " & CStr(Err.Number) & vbCrLf & _
"Error Description: " & Err.Description, vbApplicationModal + vbCritical
Resume ExitRoutine

End Function

Teste o código do Outlook.

Envie um e-mail de teste a partir da janela imediata do OutLook (CTRL+G)

? ThisOutlookSession.FnSendMailSafe("","","bernardess@gmail.com","A and A – Teste do Outlook","TEST")

Agora que já está certo de que o cóigo VBA foi instalado corretamente, partamos para o próximo passo:

NESTE EXEMPLO UTILIZAREMOS O MS ACCESS, MAS É APROPRIADO PARA QUALQUER PROGRAMA DA SUÍTE MS OFFICE COM VBA.

Chamando a função VBA do Outlook a partir do código VBA do Access
  1. Abra sua base de dados Access
  2. Crie um novo o módulo para testarmos o nosso propósito
  3. Copie e cole o código abaixo:

Option Explicit

' ACCESS VBA MODULE: Send E-mail without Security Warning
' (c) 2005 Wayne Phillips (http://www.everythingaccess.com)
' Written 07/05/2005
' Last updated v1.3 - 11/11/2005
'
' Please read the full tutorial & code here:
' http://www.everythingaccess.com/tutorials.asp?ID=Outlook-Send-E-mail-without-Security-Warning
'
' Please leave the copyright notices in place - Thank you.
      

'This is a test function - replace the e-mail addresses with your own before executing!!
'(CC/BCC can be blank strings, attachments string is optional)
      

Sub FnTestSafeSendEmail()
    Dim blnSuccessful As Boolean
    Dim strHTML As String

    strHTML = "<html>" & _
               "<body>" & _
               "My <b><i>HTML</i></b> message text!" & _
               "</body>" & _
               "</html>" 
    blnSuccessful = FnSafeSendEmail("myemailaddress@domain.com", _
                                    "My Message Subject", _
                                    strHTML)


      'A more complex example...    
    'blnSuccessful = FnSafeSendEmail("bernardess@gmail.com; secondrecipient@domain.com", _
                                         "My Message Subject", _     
                                         strHTML, _    
                                         "C:\MyAttachmentFile1.txt; C:\MyAttachmentFile2.txt", _ 
                                         "cc_recipient@domain.com", _  
                                         "bcc_recipient@domain.com")
      
    If blnSuccessful Then

        MsgBox ".: Mensagem de E-mail enviada com sucesso!"

    Else

        MsgBox ":. Falha ao enviar e-mail!"

    End If

End Sub


'This is the procedure that calls the exposed Outlook VBA function...
      
Public Function FnSafeSendEmail(strTo As String, _
                    strSubject As String, _
                    strMessageBody As String, _
                    Optional strAttachmentPaths As String, _
                    Optional strCC As String, _
                    Optional strBCC As String) As Boolean

    Dim objOutlook As Object ' Note: Must be late-binding.
    Dim objNameSpace As Object
    Dim objExplorer As Object
    Dim blnSuccessful As Boolean
    Dim blnNewInstance As Boolean


      'Is an instance of Outlook already open that we can bind to?
      
    On Error Resume Next
    Set objOutlook = GetObject(, "Outlook.Application")
    On Error GoTo 0

    If objOutlook Is Nothing Then


      'Outlook isn't already running - create a new instance...
      
        Set objOutlook = CreateObject("Outlook.Application")
        blnNewInstance = True    

      'We need to instantiate the Visual Basic environment... (messy)
      
        Set objNameSpace = objOutlook.GetNamespace("MAPI")
        Set objExplorer = objOutlook.Explorers.Add(objNameSpace.Folders(1), 0)
        objExplorer.CommandBars.FindControl(, 1695).Execute

        objExplorer.Close

        Set objNameSpace = Nothing
        Set objExplorer = Nothing

    End If

    blnSuccessful = objOutlook.FnSendMailSafe(strTo, strCC, strBCC, _
                                                strSubject, strMessageBody, _
                                                strAttachmentPaths)

    If blnNewInstance = True Then objOutlook.Quit
    Set objOutlook = Nothing

    FnSafeSendEmail = blnSuccessful

End Function

Pois é, divirtam-se…


Tags: VBA, Outlook, email, security, warning, aviso, Application, Automation



VBA OutLook: Uso do editor do Word no outlook.

Copie o código abaixo e cole no editor VBA do Outlook (ALT+F11 no Outlook). Então crie um botão no "Quick Access Toolbar" para acessar a funcionalidade. IMPORTANTE: Não esqueça de ativar a "Word object library" no Menu | Tools | Referências|, do editor VBA.


Sub TimeStamp()
Dim strText As String
Dim objItem As Object
Dim objExpl As Outlook.Explorer
Dim objInsp As Outlook.Inspector
Dim objDoc As Word.Document
On Error Resume Next

Set objNameSpace = Application.GetNamespace("MAPI")
Let MyName = objNameSpace.CurrentUser.Name
Let strText = ">> " & Date & " " & Time & " " & MyName & ":" & vbCrLf & vbCrLf & vbCrLf

Set objExpl = Application.ActiveExplorer
Set objItem = objExpl.Selection(1)

If Not objItem Is Nothing Then
Set objInsp = objItem.GetInspector

If objInsp.EditorType = olEditorWord Then
Set objDoc = objInsp.WordEditor

objDoc.Characters(1).InsertBefore strText
Else
MsgBox "Não pode inserir texto formatado a menos que o Word seja o Editor."
End If
End If

Set objInsp = Nothing
Set objDoc = Nothing
Set objExpl = Nothing
Set objItem = Nothing
Set objMsg = Nothing
End Sub

diHITT - Notícias