Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to export table data to excel sheet using vb macro, I was able to do export using macro on qv9 server, after migrating same application on qv11 export is not working. do we need to do any additional set up to enable export data to excel using macro.Also Debug option is also not available in QV11 macro window.
Nishant
You will have to activate sheet first for saving Excel.
Use the following Macro:
Sub SendReport
ActiveDocument.Sheets("SH01").Activate 'edit the sheet
'ActiveDocument.reload
set objExcel=ActiveDocument.GetSheetObject("TB03") 'edit the sheet object
strDate = Year(Date()) &"-"& month(date()) &"-"& Day(Date())
filepath="D:\Macros\Excel_"&strDate&".xls" 'edit the location of file
objExcel.ExportBiff filepath
ActiveDocument.GetApplication.Sleep 5000
End Sub
Hi Nishant,
Please can you attach macro
Hi Nitha,
Please find attached test qvw.
Thanks
Nishant
you may use the following macro..
sub Export
set obj1 = ActiveDocument.GetSheetObject("TB01")
obj1.ExportBiff "C:\Documents and Settings\596732\Desktop\manasvi\InnerJoin.xls"
msgbox("Done")
end sub
Hi,
This Macro is giving message of done, but no excel is getting saved , I changed location to
obj1.ExportBiff "C:\InnerJoin.xls" , after that also no excel file is generated.
Thanks
Nishant
Did you change the sheet object name?? In my case it is TB01. Your object id may be different.
Hi Ankit,
Object name in my case is also TB01, Actually i think issue is with my set up of qv11 , bcoz same qvw is working on qv9 , only when I am running it on qv11 its behavior is changing. Is there any additional set up is required to enable excel export using macro?.
Thanks
Nishant
Are you using version 9 and 11 on same machine or different? And which version of excel are you using?
Hi,
version 9 and 11 are installed on two different machine, I am using excel 2013 on qv11 machine and excel 2007 in qv9 machine.
Thanks
Nishant
Nishant
You will have to activate sheet first for saving Excel.
Use the following Macro:
Sub SendReport
ActiveDocument.Sheets("SH01").Activate 'edit the sheet
'ActiveDocument.reload
set objExcel=ActiveDocument.GetSheetObject("TB03") 'edit the sheet object
strDate = Year(Date()) &"-"& month(date()) &"-"& Day(Date())
filepath="D:\Macros\Excel_"&strDate&".xls" 'edit the location of file
objExcel.ExportBiff filepath
ActiveDocument.GetApplication.Sleep 5000
End Sub