I want to set a macro in Excel workbook and run/follow following steps.
After click on Shape1 (Rectangle Shape Inserted and macro assign on click)
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
After click on Shape1 (Rectangle Shape Inserted and macro assign on click)
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