Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Load Excel template
Message
From
09/06/2005 12:24:56
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
09/06/2005 11:13:03
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01021794
Message ID:
01021842
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
I have used templates more in Word than in Excel, but I think it is the same idea: You normally don't open a template, to save it with a different name; instead, you directly create a new file, based on the template. I think that would be with the .Add() method.

Now, this is for the end-user, to avoid accidentally overwriting the template with the modified version. For programmatic control, your code should work just as well. But .Add() might be simpler (one line for creating the document, one for saving it, instead of your 4 lines of code) - if it works.

>Thanks Hilmar. I actually got it, now. In case somebody might want to see the code, here's how I did it.
>
>excel = createobject('Excel.Application')
>excel.Workbooks.Open('mytemplate.xlt')
>excel.ActiveWorkbook.SaveAs('newexcelfile.xls')
>excel.ActiveWorkbook.Close()
>excel.Workbooks.Open('newexcelfile.xls)
>
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform