Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

bluecarbon
Contributor

vb Macro to browse QVW or QVD files

Hi All,

The below code works fine all type of files other than QVW, QVD and CSV.

     Is it not possible to copy a QVW file from one location to another location using vb scripts?

Sub File_Browser()

Dim objShell

Dim strFileName

Dim strFilePath

Dim objFile

Set objShell = CreateObject("Shell.Application")

Set objFile = objShell.BrowseForFolder(0, "Choose a file:", 16384)

strFileName = objFile.Title

strFilePath = objFile.self.Path

MsgBox "Just the file name: " & strFileName & vbCrLf & "The full path: " & strFilePath

Set objFileName = Nothing

Set objFilePath = Nothing

Set objShell = Nothing

End Sub

Thanks,

Rakul.

3 Replies

Re: vb Macro to browse QVW or QVD files

You could use code like this:

dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile SoureFileWithFullPath, TargetFileWithFullPath
Set objFSO = Nothing 

- Marcus

bluecarbon
Contributor

Re: vb Macro to browse QVW or QVD files

Marcus,

Thanks for writing back. Please let me know is there any way I can invoke File Browser dialog box inside Qlikview VB script, through which any other Qlikview file can be selected dynamically.

Thanks,

Rakul.

Re: vb Macro to browse QVW or QVD files

You might need another parameter in BrowseForFolder, like:

Set objFile = objShell.BrowseForFolder(0, "Choose a file:", &H4000)

See also: Using the Browse For Folder Dialog Box. Alternative would be this here: VBScript Scripting Techniques: File Open Dialog.

- Marcus

Community Browser