Import to worksheet ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DanAusitn
    New Member
    • Jun 2007
    • 15

    #1

    Import to worksheet ?

    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.
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    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:

    [CODE=vb]dim i as integer
    dim obj1 as object

    sub createAPP()
    set obj1 = createobject("e xcel.applicatio n") 'you also use "word.applicati on"
    end sub

    sub createXLS()
    obj1.workbooks. open ("c:\mytemplate .xls")
    obj1.cells(1,1) .value="Hello world"
    'optionally you can set it obj1.vislbe=tru e
    i=i+1
    obj1.workbooks( i).saveas("c:\F ile_" & i)
    if msgbox("Create another file?", vbyesno)=vbyes then call createxls
    end sub[/CODE]

    Comment

    • DanAusitn
      New Member
      • Jun 2007
      • 15

      #3
      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

      Comment

      Working...