Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i have pivot table in my project, when i click on the excel it exporting in excel it is working fine. But i want to copy the full table and paste it into new excel,this i will do by manually.Instead of doing this manually is there any possible to write a macro and creating one button,when i click on this button the report should be copy and paste in new excel.
can anyone know the macro for this please share....
regards,
baru
Try this code from rebeccad:
sub Export
set XLApp = CreateObject("Excel.Application")
XLApp.Visible = true 'you can make it false, if you want to make it in the background
set XLDoc = XLApp.Workbooks.Add
XLDoc.Sheets(1).name = "Export"
set XLSheet = XLDoc.Worksheets(1)
set MyTable = ActiveDocument.GetSheetObject("CH01") 'Change CH01 to the object you want to export to Excel (Object Properties > General tab > far right)
set XLSheet = XLDoc.Worksheets(1) 'Select sheet where data should be pasted
Mytable.CopyTableToClipboard true 'Copy data to Clipboard
XLSheet.Paste XLSheet.Range("A1") 'Paste data starting at A1
End Sub
Hi Gysbert,
Thanks for your reply,
it is not working,when i click on the button macro is opening,can you please explain me little bit more...
Hi Gysbert,
Thanks for your reply,
it is not working,when i click on the button macro is opening,can you please explain me little bit more...
Set Requested Module Security to System Access and Current Local Security to Allow System Access. This is need to allow the macro to create an Excel instance.
hi,
I enabled this two options,but still same error.