Home > database >  Experts to help me take a look at this piece of VBA, how to convert to PB code
Experts to help me take a look at this piece of VBA, how to convert to PB code

Time:09-27

With ActiveWorkbook. PivotCaches. Add (SourceType:=xlExternal)
. The Connection="ODBC; DRIVER=SQL Server; SERVER=(local); UID=JJ; APP=2003 Microsoft Office; WSID=LJJ; The DATABASE=gz_mis; Trusted_Connection=Yes "
The CommandType=xlCmdSql
The CommandText=Array (" SELECT A01. A0101, A01. A0104, A01. A0107, A01. A0132, T_XGZ_GZBDMC. BDHZW, T_XGZ_GZBDMC. BDHJB, T_XGZ_GZBDMC. BDHDC "& amp; CRH (13) & amp; "" & amp; CRH (10) & amp; "FROM gz_mis. Dbo. A01 A01 and gz_mis. The dbo. T_XGZ_GZBDMC T_XGZ_GZBDMC" & amp; CRH (13) & amp; "" & amp; CRH (10) & amp; "WHERE A01 leader_code=T_", "XGZ_GZBDMC. Leader_code")
. CreatePivotTable TableDestination:="[Book3] Sheet1! R1C1 ", TableName:="pivot table 1", DefaultVersion:=xlPivotTableVersion10
End With

Main purpose: to open the EXCEL in PB and automatically connect to the database and create a good pivot table
VBA is easy to implement, and you don't know how to PB code, hope can derive some warrior, best can transform the code above, need not grateful ~ ~ ~

CodePudding user response:

Bring your VBA macros EXCEL under PB program, PB adjustable direct call this macro
  • Related