Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
If user wants to export a straight table or pivot table into CSV format, then user have to right click onto the object and then select the file type-CSV and give file name, then user can export table into CSV format.
But on front end, I want to create a button. User will click on it which will enable user to export the table (straight table id: Ch03) into CSV format by just clicking on it.
All ur ideas are warmly welcomed. . .
Regards,
BRIJESH
Hi,
You can write a macro for that and run the macro on the button click event.
Search community. I saw ready script in some thread...
Hi,
The following code creates the Excel sheet in correct format.
sub Export
set obj1 = ActiveDocument.GetSheetObject("TB01")
obj1.ExportBiff "C:\Documents and Settings\596732\Desktop\manasvi\InnerJoin.xls"
msgbox("Done")
end sub
Create a buton and run the macro on click.
Sir,
You are right that I can export table onto some specific path on server.
C:\Documents and Settings\596732\Desktop\manasvi\InnerJoin.xls
I do not want to export onto my server. I had NT authentication; each user should be able to export into CSV format on their local machine by clicking onto it.
Thanks for ideas. . . keep idea'ING', please!!!
Regards,
BRIJESH
Hi,
Try this
sub Export_To_Excel_View1
Dim xlApp
Dim xlBook
Dim xlSheet
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = true
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets("Sheet1")
Set Doc = ActiveDocument
Doc.GetSheetObject("CH89").CopyTableToClipBoard true
xlApp.ActiveSheet.Range("A1").Select
xlApp.ActiveSheet.Paste
end sub
It wil create a excel as soon as run on button click event and the user can save it at desired location.
Hi Mishra,
thanks. . .
Getting error
ActiveX component can't create object: 'Excel.Application'
at this line:
Set xlApp = CreateObject("Excel.Application")
And each user should be able to export into CSV format on their local machine by clicking onto it. Export to Excel icon is already there in Qlikview on right hand corner of each object.
Hi Brijest,
Please find the attached Application.
Code:
sub Export
set XLApp = CreateObject("Excel.Application") ' Define Object
XLApp.Visible = True 'Visible set as true
set XLDoc = XLApp.Workbooks.Add 'Open new workbook
set table = ActiveDocument.GetSheetObject("CH01")
rem set table = ActiveDocument.GetSheetObject("MB01")
set XLSheet = XLDoc.Worksheets(1) 'Select sheet where data should be pasted
table.CopyTableToClipboard true 'Copy data to Clipboard
XLSheet.Paste XLSheet.Range("A1") 'Paste data into cell
end sub
Regards
ASHFAQ
Hi Mohammed.
Could you please also the code to save automatically the Excel file in a specified path?
This will help in order to get a whole scenario.
Thanks a lot
Alberto
Hi,
Check this
Sub Test
XLSFile = "C:\Temp\test.xls"
TXTFile= "C:\Temp\test.txt"
Set objExcelApp = CreateObject("Excel.Application")
Set objExcelDoc = objExcelApp.Workbooks.Add
set xlSheet = objExcelDoc.Sheets("Sheet1")
ActiveDocument.GetSheetObject("TB01").CopyTableToClipboard true
xlSheet.Range("A1").Select
xlSheet.Paste
objExcelApp.DisplayAlerts = false
objExcelDoc.SaveAs XLSFile
objExcelDoc.SaveAs TXTFile, -4158
objExcelDoc.Close
objExcelApp.DisplayAlerts = true
End Sub
Regards
ASHFAQ