By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

Import to worksheet ?

P: 15
Good afternoon people

I am currently trying to create a program that produces a generic worksheet but with differant information on the worksheet
so far i have made an interface in which to add the varibles you wish to see on the sheet,

i was wondering if there is a way to possibley import the varibles into a template in word or maybe exel from my program. kind of like when you press go it will produce a full worksheet for you but only the varibles you set will differ.

anyway thanks for reading.
Sep 6 '07 #1
Share this Question
Share on Google+
2 Replies


kadghar
Expert 100+
P: 1,295
i think the simpliest way is to have an excel worksheet or a word document with the template, and then just open it, make the changes you need and save it with different name.

to open it just create an object, something like:

Expand|Select|Wrap|Line Numbers
  1. dim i as integer
  2. dim obj1 as object
  3.  
  4. sub createAPP()
  5. set obj1 = createobject("excel.application") 'you also use "word.application"
  6. end sub
  7.  
  8. sub createXLS()
  9. obj1.workbooks.open ("c:\mytemplate.xls")
  10. obj1.cells(1,1).value="Hello world"
  11. 'optionally you can set it obj1.vislbe=true
  12. i=i+1
  13. obj1.workbooks(i).saveas("c:\File_" & i)
  14. if msgbox("Create another file?", vbyesno)=vbyes then call  createxls
  15. end sub
Sep 6 '07 #2

P: 15
cheers thats extremely helpful, what i had in mind is something that produces the complete worksheet at the end after entering vars, but this method is just as good. thank you
Sep 6 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.