• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Link with External Data (SQL) through VBA

curious K

New Member
I want to set a macro in Excel workbook and run/follow following steps.

After click on Shape1 (Rectangle Shape Inserted)

Insert New Sheet with Name : BOQ

Remove if any table exist with name : BOQTbl in open workbook

Remove if any Existing Connection name : AgBOQ
{or Overwrite following setting on existing above named connection}

Create Connection for External Data "From other sources" {Option under Data tab}

From SQL Server
Server Name : e.g. 192.168.0.1
Log on Credentials :
User Name : sa

Selection Database : MyCoTempDB
FileName : AgBOQRec
FriendlyName : AgBOQRec
Select : View_AgBOQ
Select "SQL" as view this data
Referance for data putting $a$1
Property :
Command type : SQL
Command Text : select pname,sname,srlno,col1,col2,col12 from View_AgBOQ order by pname,sname,srlno
 
Back
Top