Rose Glazewski
Rose Glazewski

Reputation: 11

Can Smart View VBA HypConnect be used to connect to the application but not activate it on the sheet?

When using HypConnect in Excel, it automatically activates the connection to the sheet it happens to be on when the macro is run. However, if you choose Connect from the Smart View Panel, it connects to the application/database but does not activate it on any sheet.

I have a report that uses connections to multiple applications/databases. Unfortunately, the first HypConnect activates that application/database to the current sheet and then ignores the remaining connection requests. I only need it to connect to the applications/databases and then the rest of the macro takes care of refreshing the worksheets as necessary. The remainder of the macro works if I connect to each application/database manually before running it.

I am running 64 bit Microsoft Office 365 Excel Version 1910 (Build 12130.20390) on 64 bit Windows 10 Enterprise (v10.0.17763). SmartView is Version 11.1.2.5.710 (Build 127) and Essbase is 11.1.2.3.508

Here is an example of the code that I am trying to use:

Public Declare PtrSafe Function HypConnect Lib "HsAddin" (ByVal vtSheetName As Variant, ByVal vtUserName As Variant, ByVal vtPassword As Variant, ByVal vtFriendlyName As Variant) As Long
Public Declare PtrSafe Function HypDisconnectAll Lib "HsAddin" () As Long
Public Declare PtrSafe Function HypMenuVRefreshAll Lib "HsAddin" () As Long
Sub RunAllFreaks()


x = HypConnect("Empty", "UserName", "Password", "EssbaseCluster-p_FXAPAC_FXAPAC")
x = HypConnect("Empty", "UserName", "Password", "EssbaseCluster-qa_FXAPAC_FXAPAC")
x = HypConnect("Empty", "UserName", "Password", "EssbaseCluster-p_FXEMLA_FXEMLA")
x = HypConnect("Empty", "UserName", "Password", "EssbaseCluster-qa_FXEMLA_FXEMLA")
x = HypConnect("Empty", "UserName", "Password", "EssbaseCluster-p_FXGP_FXGP")
x = HypConnect("Empty", "UserName", "Password", "EssbaseCluster-qa_FXGP_FXGP")
x = HypConnect("Empty", "UserName", "Password", "EssbaseCluster-p_FXNA_FXNA")
x = HypConnect("Empty", "UserName", "Password", "EssbaseCluster-qa_FXNA_FXNA")

Worksheets("Setup Recon Tabs").Range("Recon1_App1_Connection").Value = "EssbaseCluster-p_FXAPAC_FXAPAC"
Worksheets("Setup Recon Tabs").Range("Recon1_App2_Connection").Value = "EssbaseCluster-qa_FXAPAC_FXAPAC"
Worksheets("Setup Recon Tabs").Range("Recon2_App1_Connection").Value = "EssbaseCluster-p_FXAPAC_FXAPAC"
Worksheets("Setup Recon Tabs").Range("Recon2_App2_Connection").Value = "EssbaseCluster-qa_FXAPAC_FXAPAC"
Worksheets("Setup Recon Tabs").Range("Recon4_App1_Connection").Value = "EssbaseCluster-p_FXAPAC_FXAPAC"
Worksheets("Setup Recon Tabs").Range("Recon4_App2_Connection").Value = "EssbaseCluster-qa_FXAPAC_FXAPAC"

Worksheets("Entity").Range("PARAM_StartIndex").Value = 1
Worksheets("Entity").Range("PARAM_EndIndex").Value = 8

RefreshDataAll

Worksheets("Setup Recon Tabs").Range("Recon1_App1_Connection").Value = "EssbaseCluster-p_FXEMLA_FXEMLA"
Worksheets("Setup Recon Tabs").Range("Recon1_App2_Connection").Value = "EssbaseCluster-qa_FXEMLA_FXEMLA"
Worksheets("Setup Recon Tabs").Range("Recon2_App1_Connection").Value = "EssbaseCluster-p_FXEMLA_FXEMLA"
Worksheets("Setup Recon Tabs").Range("Recon2_App2_Connection").Value = "EssbaseCluster-qa_FXEMLA_FXEMLA"
Worksheets("Setup Recon Tabs").Range("Recon4_App1_Connection").Value = "EssbaseCluster-p_FXEMLA_FXEMLA"
Worksheets("Setup Recon Tabs").Range("Recon4_App2_Connection").Value = "EssbaseCluster-qa_FXEMLA_FXEMLA"

Worksheets("Entity").Range("PARAM_StartIndex").Value = 9
Worksheets("Entity").Range("PARAM_EndIndex").Value = 16

RefreshDataAll

Upvotes: 1

Views: 1512

Answers (0)

Related Questions