在 Smart View for Oracle 中创建 VBA 刷新宏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18185406/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 16:23:37  来源:igfitidea点击:

Creating a VBA Refresh Macro in Smart View for Oracle

excelvbahyperionepm

提问by user2674605

Does anyone know the VBA Code that I need to use so that I can automatically “Refresh” and “Refresh All” using EPM (Hyperion) Smartiew? The “Refresh” function pulls the data into Excel on the active tab where the “Refresh” all function refreshes all tabs in the Workbook.

有谁知道我需要使用的 VBA 代码,以便我可以使用 EPM (Hyperion) Smartiew 自动“刷新”和“全部刷新”?“刷新”功能将数据拉入 Excel 中的活动选项卡,其中“刷新”所有功能刷新工作簿中的所有选项卡。

I'd like to create a simple macro attached to a command button in Excel and I'm not sure which VBA code to use.

我想在 Excel 中创建一个附加到命令按钮的简单宏,但我不确定要使用哪个 VBA 代码。

I tried recording a macro where by I simply starting recording clicked refresh and stop recording although this did not work.

我尝试录制一个宏,我只是开始录制点击刷新并停止录制,尽管这不起作用。

I tried this code just for the refresh:

我试过这个代码只是为了刷新:

Declare Function HypMenuVRefresh Lib "HsAddin.dll"() As Long

Sub MRetrieve()
  X = HypMenuVRefresh()
End Sub

But received an error message saying that I had to update the declare method for use with a 64 bit system (I am using a 64 bit system).

但是收到一条错误消息,说我必须更新用于 64 位系统的声明方法(我使用的是 64 位系统)。

Does anyone know how I could create this automatic Macro to refresh the data?

有谁知道我如何创建这个自动宏来刷新数据?

Any help would be much appreciated!

任何帮助将非常感激!

回答by Jim Hervier

The declaration for x64 in VBA is not correct.

VBA 中 x64 的声明不正确。

Try:

尝试:

Private Declare PtrSafe Function HypMenuVRefresh Lib "HsAddin" () As Long

Sub refreshWS()

    Dim Count, i As Integer

    i = 1

    Count = Worksheets.Count

    Do While i <= Count

        Sheets(i).Select

        MsgBox Sheets(i).Name

        Call HypMenuVRefresh

        i = i + 1

    Loop

    MsgBox "done"

End Sub

回答by Mr.Monshaw

HypRetrieveRangecan refresh or update a range of information, there are also a number of other functions that might suit what you want depending on how much information you need to refresh. Did you import the entire smartview.basfile like they recommended?

HypRetrieveRange可以刷新或更新一系列信息,还有许多其他功能可能适合您的需求,具体取决于您需要刷新多少信息。您是否按照smartview.bas他们的建议导入了整个文件?

回答by joao

Sub Refresh()
    '
    ' Refresh Macro
    ' Macro recorded 8/12/2011 by joao-oliveira
    '
    Dim oBar As CommandBar
    Set oBar = Application.CommandBars("Worksheet Menu Bar")
    oBar.Controls("Hyperion").Controls("Refresh").Execute
End Sub

回答by Charles Beyer

Use the function calls that basically simulate pressing the buttons!

使用基本上模拟按下按钮的函数调用!

Refresh current worksheet

刷新当前工作表

Declare Function HypMenuVRefresh Lib "HsAddin.dll" () As Long  
lngReturn = HypMenuVRefresh()
Declare Function HypMenuVRefresh Lib "HsAddin.dll" () As Long  
lngReturn = HypMenuVRefresh()

Refresh All Worksheets

刷新所有工作表

Declare Function HypMenuVRefreshAll Lib "HsAddin.dll" () As Long  
lngReturn = HypMenuVRefreshAll()
Declare Function HypMenuVRefreshAll Lib "HsAddin.dll" () As Long  
lngReturn = HypMenuVRefreshAll()

*NOTE :Return value of 0is 'OK'

*注意:返回值为0“OK”

回答by user2836536

This worked for me. You'll be able to assign this macro to any button. Instead of using the refresh all function, I am using the HypMenuVRefreshfunction within each worksheet.

这对我有用。您将能够将此宏分配给任何按钮。我没有使用 refresh all 函数,而是在每个工作表中使用HypMenuVRefresh函数。

Sub refreshWS()
Dim Count, i As Integer

 i = 1
 Count = Worksheets.Count

    Do While i < Count

     Sheets(i).Select
     Call HypMenuVRefresh
     i = i + 1

    Loop

    MsgBox "done"

End Sub

回答by Imperator

Create a button and assign it a new subroutine. Use the call command to call the public function.

创建一个按钮并为其分配一个新的子程序。使用 call 命令调用公共函数。

Sub RefreshHFM()
'
' RefreshHFM Macro
'
    Call HypMenuVRefreshAll
'
End Sub