将Qlikview报告导出到Excel

时间:2016-02-08 10:11:36

标签: vbscript macros qlikview

我创建了一个Qlikview报告,我想将其导出到Excel电子表格。该报告共有8张/标签和导航功能。经过一些研究后,我发现我需要在执行button的报告上创建macro

我和Qlikview的经验有限,但我只能创建button

有人可以指出我正确的方向或更好的方向,给我一个macro

1 个答案:

答案 0 :(得分:2)

您需要在按钮上设置操作并选择外部运行宏。 在宏名称字段中,键入宏函数/子例程的名称(在本例中为" MacroTest")。

按"编辑模块......"您可以访问宏编辑模式(或按Ctrl + M)

Sub BidDB()
Dim SummarySheet As Worksheet
Dim FolderPath As String
Dim NRow As Long
Dim FileName As String
Dim WorkBk As Workbook
Dim sourceRange As Range
Dim DestRange As Range
Dim FileToOpen As String

'Application.ScreenUpdating = False


' Create a new workbook and set a variable to the first sheet.
Set SummarySheet = ActiveWorkbook.ActiveSheet

' Folder than contains the files
'FolderPath = "Z:\Bids\"


' Where to insert new rows in the destination workbook.
NRow = 3

' Dir to find all Excel files in the folder path.
'FileName = Dir(FolderPath & "*.xls")
 FileName = Application.GetOpenFilename("Excel workbooks (*.xls*), *.xls*")


' Loop until Dir returns an empty string.
Do While FileName <> "False"

    'Open a workbook in the folder
    'Set WorkBk = Workbooks.Open(FolderPath & FileName)
     Set WorkBk = Workbooks.Open(FileName)

    ' Set the cell in column A to be the file name.
    SummarySheet.Range("A" & NRow).Value = FileName

    ' Date
    Set sourceRange = WorkBk.Worksheets(1).Range("H4:I4")
    Set DestRange = SummarySheet.Range("B" & NRow)
    Set DestRange = DestRange.Resize(sourceRange.Rows.Count, _
       sourceRange.Columns.Count)
    DestRange.Value = sourceRange.Value

    ' Increase NRow so that we know where to copy data next.
    NRow = NRow + DestRange.Rows.Count

    ' Close the source workbook without saving changes.
    WorkBk.Close savechanges:=False

    ' Use Dir to get the next file name.
    'FileName = Dir()
    FileName = Application.GetOpenFilename("Excel workbooks (*.xls*), *.xls*")

Loop

' Call AutoFit on the destination sheet
SummarySheet.Columns.AutoFit
'Application.ScreenUpdating = True

按按钮,将出现一个消息框。

关于excel导出,谷歌可以找到许多有用的例子。

祝你好运 // Micke