For Dummies 978-0-470-53218-8 Scheda Tecnica

Navigare online o scaricare Scheda Tecnica per Manuali per software For Dummies 978-0-470-53218-8. For Dummies Access 2010 All-in-One Manuale Utente

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 16
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 0
Chapter 1: Automation with
Other Office Programs
In This Chapter
Understanding Automation
Adding a contact to Microsoft Outlook
Merging data with a Word document
Exporting data to Excel
I
n Book VIII, we show you VBA (Visual Basic for Applications) and give
you an understanding of some of the wonderful ways you can take con-
trol of your Access database. You can use VBA to open and close forms,
print reports, loop through tables and change data, and modify form
properties.
Well, VBA isn’t there just for Access; you can also use VBA to control
other Microsoft Office applications including Outlook, Excel, Word, and
PowerPoint. With VBA, the possibilities are virtually endless when you con-
sider what some advanced users do in these Office applications on a daily
basis. This chapter explains Automation and gives several examples of how
Access can interact with these other Office programs.
What Is Automation?
Automation came about during the industrial revolution to replace tasks
performed by humans with faster, more efficient methods. Instead of phone
operators manually plugging and unplugging wires to make a connection,
large systems handle this automatically. Rather than having people assem-
ble cars on the assembly line, industrial robots now handle the bulk of the
duties. Us humans just get in the way.
In the world of VBA, Automation (with a capital A) refers to the ability of
a program to expose itself to VBA so that VBA can control it behind the
scenes, with little or no human interaction. Humans just slow down the
process anyway. Other programming languages such as C++ and C# use
Automation as well, but since VBA is the language of Access, we focus on
using VBA.
44_532188-bk09ch01.indd 66544_532188-bk09ch01.indd 665 3/29/10 10:59 PM3/29/10 10:59 PM
COPYRIGHTED MATERIAL
Vedere la pagina 0
1 2 3 4 5 6 ... 15 16

Sommario

Pagina 1 - COPYRIGHTED MATERIAL

Chapter 1: Automation with Other Office ProgramsIn This Chapter✓ Understanding Automation✓ Adding a contact to Microsoft Outlook✓ Merging data with a

Pagina 2 - Using Object Libraries

674Merging Data with a Word DocumentFor this example, we created three bookmarks: CurrentDate, AccessAddress, and AccessSalutation. We then saved the

Pagina 3 - The Application object

Book IXChapter 1Automation with Other Office Programs675Merging Data with a Word Document ‘Open Word using template and make Word visible Wrd.Docume

Pagina 4

676Merging Data with a Word DocumentAfter opening an instance of Word, we set the location of the Word template created earlier. We use the Path prope

Pagina 5 - Adding a Contact to Outlook

Book IXChapter 1Automation with Other Office Programs677Exporting Data to Excel Figure 1-7: The final merged document in Word. Exporting Data to Excel

Pagina 6

678Exporting Data to Excel ‘Declare and set the Recordset object Dim rs As New ADODB.Recordset rs.ActiveConnection = cnn ‘Declare and set the SQ

Pagina 7

Book IXChapter 1Automation with Other Office Programs679Exporting Data to Excel ‘Declare and set the Connection object Dim cnn As ADODB.Connection

Pagina 8 - Creating a Word template

680Exporting Data to Excel .Font.Bold = True .Font.Color = vbBlue End WithNow it’s time to take the data from the Recordset object and put it i

Pagina 9

666Using Object Libraries Automation with other Microsoft Office programs works only when you have these programs installed on your computer. If you

Pagina 10 - Writing the merge code

Book IXChapter 1Automation with Other Office Programs667Using Object LibrariesExploring an object libraryAfter adding a reference to a program’s objec

Pagina 11 - Office Programs

668Using Object Librariesto VBA. For example, if VBA opens a Word document, everything in that Word document is also exposed. VBA can do anything in t

Pagina 12

Book IXChapter 1Automation with Other Office Programs669Adding a Contact to OutlookIn the next few sections, you’ll see how Access can share informati

Pagina 13 - Exporting Data to Excel

670Adding a Contact to Outlook ‘Set Contact Properties and Save With OlkContact .FirstName = Me.FirstName .LastName = Me.LastName Me.Email

Pagina 14

Book IXChapter 1Automation with Other Office Programs671Adding a Contact to OutlookNow let’s look at the next block of code: ‘Set Contact Properties

Pagina 15

672Merging Data with a Word Document Figure 1-4: The contact added to Outlook from VBA. Merging Data with a Word DocumentMicrosoft Word is probably th

Pagina 16

Book IXChapter 1Automation with Other Office Programs673Merging Data with a Word Documentso you need to display them so you can see what you’re doing.

Commenti su questo manuale

Nessun commento