Hi everyone.
I have some code which creates excel (.xls) files for reports which are required to be in a certain format, so I created a template in excel and using OLE swap in the values.
Now this is working fine but the client has just asked if we can populate an MW word document at certain points with these tables and I was wondering, if anyone has already done something similar and if its possible via OLE?
Any help would be greatly welcomed.
Cheers!
Hi Dale,
I was waiting to see if someone had a solution for you.
I have added regular tables to Word documents but not Excel spreadsheets.
Two approaches I can think of:
1. Run the macro recorder in Word, paste in the excel, use the VBA editor to see the recorded commands, translate them to Basic+
2. Create the word document with the Excel table in place and easily recognized token values in the table cells, save the worksheet in XML format, then osread the xml, swap the token values for real values, osewrite to a temp location, then call Shellexecute(0, 'Print', myfile:\00\,
,
, 1)
Thanks Bob, I will give it a try with the macro recorder and will post my results.
Cheers! Dale.