Wednesday, March 2, 2011

Broken Links: A workaround for Smart View cell functions

One issue found by those who use Smart View cell functions (i.e. HsGetValue) is that the functions can get "disoriented" when distributed to other users or used in a Citrix environment. The result of this disorientation is that the functions in the cells get preceeded by by the full path of the source system (C:\Oracle\SmartView\bin\HsTbar.xla!HsGetValue....) and no longer are valid.

There is a workaround that has proven successful for those who are confronted with this problem. It is simply to add a BAS file to a working Smart View workbook and in this BAS file put the following function declarations and conversion routine:


' Function Smartview VBA Declaration.
Declare Function HsGetValue Lib "HsAddin" (ParamArray MemberList() As Variant) As Variant
Declare Function HsSetValue Lib "HsAddin" (ByVal Value As Variant, ParamArray MemberList() As Variant) As Variant
Declare Function HsGetText Lib "HsAddin" (ParamArray MemberList() As Variant) As Variant
Declare Function HsSetText Lib "HsAddin" (ByVal text As Variant, ParamArray MemberList() As Variant) As Variant
Declare Function HsLabel Lib "HsAddin" (ParamArray MemberList() As Variant) As Variant
Declare Function HsDescription Lib "HsAddin" (ParamArray MemberList() As Variant) As Variant
Declare Function HsCurrency Lib "HsAddin" (ParamArray MemberList() As Variant) As Variant



'**************************************************************************
' For converting existing XLA cell functions to use a local function reference
'**************************************************************************

Sub ConvertFunctionsToLocal()

ActiveWorkbook.ChangeLink "HsTbar.xla", ThisWorkbook.FullName, XlLinkType.xlLinkTypeExcelLinks

End Sub



Running the conversion routine will change all of the current cell functions to use the functions declared in the workbook instead of the functions declared in HsTbar.xla.

And that's it. The workbook will be a self-contained solution that can be passed around or placed in a Citrix environment without the worry of broken links.

4 comments:

amarnath said...

Hi Matt
The information is really helpful.
I need one more information of where you have found these functions as I was not able to see those in smartview.bas file. Do you have a reference for this?

Mike Larimer said...

These functions are not normally contained in the SmartView.bas file. You will need to add them to the bas file in order to override the default Smart View behavior for functions.

Martin Foster said...

Hi Mike,

would it be possible to provide a short description what exactly needs to be done in order to add the BAS file to the workbook with hsgetvalue functions?
Thank you for any hints.

Mike Larimer said...

- Open the Excel workbook.
- ALT-F11 to open the VBA editor.
- Right click on Excel Objects folder.
- Select Insert | Module
- Copy and paste the code from this blog into the newly created module (i.e. BAS file).