Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Browse csv file through macro.

Hi,

Sub BrowseFolder

          Const OverWrite = True

          Dim destpath,  srcFiles

     Set objShell = CreateObject("Shell.Application")

     Set objFolder = objShell.BrowseForFolder(0, "Example", 16384,"Computer")

           If objFolder Is Nothing Then

          Wscript.Quit

     End If

 

            ActiveDocument.Variables("vFileName").SetContent objFolder.title, true

           ActiveDocument.Variables("vFolderName").SetContent objFolder.self.path, true   

     MsgBox "folder: " & objFolder.title & " Path: " & objFolder.self.path

End Sub

Above macro codes working fine for excel, i need to browse csv file so kindly guide me.

Regards,

Zain.

1 Reply
Not applicable
Author

Sub CopyFile

           Dim fso

     Set fso = CreateObject("Scripting.FileSystemObject")

            srcFiles = ActiveDocument.Variables("vFolderName").GetContent.String

           destPath = "c:\"

     Set fso = CreateObject("Scripting.FileSystemObject")

           fso.CopyFile srcFiles,destPath, True

          

           set vLog = ActiveDocument.Variables("vLog")

          

     content = vLog.GetContent.String

     vLog.SetContent  Now & " File "& chr(34) & file & chr(34) &" copied the File successfully by SIVA from " & srcFiles & "To the folder" &destPath  & chr(34) & chr(34) & vbCr & vbLf & content, true

              ActiveDocument.Save

 

     Msgbox("copy file Complete!")

           MsgBox "File successfully copied by SIVA from " & srcFiles & "To  c:\"

End Sub

Kindly check above code to copy file, above code define after browse code can you plz check here need to any change.

Regards,

Zain.