|
Public Sub GoGetProducts()
6 n4 s4 |$ i- f% b. J/ ]Dim rsProducts As ADODB.Recordset: H; Q+ K5 a6 b; m
Set reProducts = New ADODB.Recordset
$ U1 x8 t5 y$ [' S+ J+ {8 Y5 t) ZrsProducts.Open Source:="Products", activeconnection:="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb", CursorType:=adOpenStatic, LockType:=adLockOptimistic, Options:=adCmdTable( h: P9 C3 U/ j8 N6 o$ x
With Worksheets("Sheet1")$ n8 Z' \5 \9 {" X q2 {0 e
.Range("A1").CurrentRegion.Clear
: {2 Q- e, `2 r# ~2 _; IApplication.Intersect(.Range(.Rows(1), .Rows(rsProducts.RecordCount)), .Range(.Columns(1), .Columns(rsProducts.Fields.Count))).Value = MyTranspose(rsProducts.GetRows(rsProducts.RecordCount))
" \+ }3 p, o9 z9 v$ d1 U! UEnd With
2 q# ]6 P2 N7 ?5 h* `4 ^2 _( H/ t5 arsProducts.Close! L6 y2 X+ _: r1 Y- F: Z! i
End Sub
% E+ Z+ V) k, a - D3 Z2 v. G/ q2 ?% K
& X: K4 O! A& W: Q* G
红色字的命令,VBA总是提示“对象变量或with块变量未设置”% M5 S9 ]0 b0 P6 J1 y2 L& s: ^
请求高手帮助,到底出了什么问题,应该如何修改? |
|