在刷新SmartView Hyperion之后复制工作表时,单元格值会丢失吗?

时间:2019-07-02 14:31:10

标签: excel vba hyperion

已通过HypMenuVRefresh()成功刷新了具有Smart View / Hyperion公式的Excel工作表,然后将其复制到新工作簿中,以用值替换并整理公式,但是复制会丢失单元格值。

从在线研究来看,该副本似乎丢失了所需的SmartView / Hyperion元数据,可以通过HypCopyMetaData()将其重新导入到已复制的工作表中……请参阅《开发人员指南》 https://docs.oracle.com/cd/E72988_01/DGSMV/ch04s07.html

成功刷新源工作表后,我尝试复制到相同的wb和另一个wb,但是两者均导致相同的错误。

没有其他API调用。主要功能复制功能区按钮(HypMenuVRefresh =刷新),并且在采用用户凭据时无需通过VBA创建Hyperion连接即可工作。是否需要为非菜单功能(即任何未开始“ HypMenu ....”的功能)建立连接?

VBA API声明32和64位

#If VBA7 Then
    Private Declare PtrSafe Function HypMenuVRefresh Lib "HsAddin" () As Long       
    Private Declare PtrSafe Function HypCopyMetaData Lib "HsAddin" (ByVal vtSourceSheetName As Variant, ByVal vtDestinationSheetName As Variant) As Long
#Else
    Private Declare Function HypMenuVRefresh Lib "HsAddin"() As Long                
    Private Declare Function HypCopyMetaData Lib "HsAddin" (ByVal vtSourceSheetName As Variant, ByVal vtDestinationSheetName As Variant) As Long
#End If

要导入元数据的主VBA子项:

Private Sub sSmartViewAPI_ImportHyperionMetaDataForASheet(ByRef argwb_DestWB As Workbook, ByVal vtSourceSheetName As Variant, ByVal vtDestinationSheetName As Variant)

    'The destination sheet MUST be active
    argwb_DestWB .Activate
    argwb_DestWB .Sheets(vtDestinationSheetName).Activate

    'Perform the refresh & capture the status
    Dim ll_Status As Long
    ll_Status = HypCopyMetaData(vtSourceSheetName, vtDestinationSheetName)

    'Display message if status is not 0, all others are errors
    If ll_Status <> 0 Then
        MsgBox "HYPERION IMPORT METADATA ERROR"
        End
    End If

End Sub

SmartView / Hyperion错误代码-3“初始化错误”。返回,并且公式错误显示在单元格中,而不是从Hyperion成功检索的值。

我们如何在不丢失单元格值的情况下复制工作表?

0 个答案:

没有答案