Whenever I change windows of opened workbooks and come back to MyFile.xlsb where I have defined external connection, the refresh of all pivot tables in MyFile.xlsb runs automatically. Needless to add it is very annoying feature. How to disable it? How to run refresh all only on demand. Important note. This problem occurs only on computers of the users I distribute MyFile.xlsb. On my computer it works ok.
I have defined the external connection as a reference to stored procedure in SQL.
Connection string:
Provider=SQLOLEDB.1;
Integrated Security=SSPI;
Persist Security Info=True;
Initial Catalog=MyDataBase;
Data Source=MyServerName;
Use Procedure for Prepare=1;
Auto Translate=True;
Packet Size=4096;
Workstation ID=MyWorkstationID;
Use Encryption for Data=False;
Tag with column collation when possible=False
Here is SQL stored procedure I call.
CREATE PROCEDURE [dbo].[MyProcedure]
AS
BEGIN
-- part one, show user what he has to see
SELECT *
FROM [dbo].[MyView]
ORDER BY 1
-- part two, get user data
INSERT INTO dbo.My_other_table_logins_history
SELECT
GETDATE(),
ORIGINAL_LOGIN()
END
The concept of using this procedure is explained here: SQL procedure from Excel run from connection properties with user login as parameter

