Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export to excel on reload

I have used the document settings to run rhis macro after reload.

When I test it in the edit module window it runs OK and creates the export file. However, if I reload the document it reloads and then opens the module window and stops at the Set obj line.

Why? Does qanyone know how I fix this problem?

Sub ExporttoExcel()

Set obj =ActiveDocument.GetSheetObject("TB01")

Obj.ExportBiff "C:\temp\Testajr.xls"

End sub

Regards

Adrian



2 Replies
Not applicable
Author

It seems to work with OnOpen rather than post load.

Not sure why

Srinivas
Creator
Creator

Hi

use below logic by steps wise:

sub Export

set obj1 = ActiveDocument.GetSheetObject("TB01")

obj1.Export "D:\Yourfilename.xls",4

msgbox("Done")

end sub

Goto Document Properties--->Trigger---->OnPostReload--->Add Action--->Add---> External--->Run Macro---> give macro name(Export)   After that click on Edit-model and past your logic and ok ---> apply

after reloading the application then automatically exporting to excel, Can you check your path there excel will appeared..

Regards,

Munna