SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 59 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

accdb for
Access databases.
4. In the Select Table dialog box, choose Employees Extended, and click OK.
5. In the Import Data dialog box, you have choices of how you want to view the data
(table, PivotTable, or PivotChart) and where you want to put the data, as well as
advanced options. For now, just accept the defaults by clicking the OK button.
The code generated from this looks like Listing 2-1.
Listing 2-1.Macro-Generated Data Access Code
Sub GetAccessData()
'
' GetAccessData Macro
' Code created by Excel 2007 Macro Recorder
'
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( ??
"OLEDB;Provider=Microsoft.ACE.OLEDB.12.0;Password="""";User ID=Admin;" ??
& "Data Source=C:\projects\Excel2007Book\Files\Northwind 2007.accdb;Mod" ??
, ??
"e=Share Deny Write;Extended Properties="""";" ??
& "Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";" ??
& "Jet OLEDB:Database Password=""""" ??
, ??
";Jet OLEDB:Engine Type=6;Jet OLEDB:Database Locking Mode=0;" ??
& "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transaction" ??
, ??
"s=1;Jet OLEDB:New Database Password="""";" ??
& "Jet OLEDB:Create System Database=False;" ??
& "Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't C" ??
, ??
"opy Locale on Compact=False;" ??
& "Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;" ??
& "Jet OLEDB:Support Complex Data=Fa" ??
, "lse"), Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdTable
.CommandText = Array("Employees Extended")
CHAPTER 2 n DATA IN, DATA OUT 44
.


Pages:
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71