Results 1 to 6 of 6

Thread: Saving the Excel VB

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    69

    Saving the Excel VB

    Hi I have another simple question.

    How can I save the contents in excel without overwriting it but appending it under the same filename? I uses VB Commondialog but everytime I save using same filename, the initial contents are gone!

    Pls help. Thanks in advance

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Saving the Excel VB

    I think you have to save it as a temp file, delete the original, and then rename the temp file with the original name.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    69

    Re: Saving the Excel VB

    I don't really get it. The first file actually generate some result I want to keep, when the program runs for the second time, then it generate another set of result. I need to append result 1 and result 2. How to go about it in coding?

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Saving the Excel VB

    save the first wb sheets into the second one, and save it. you coud use different sheets. if you provide an example of how many sheets, which rows, etc., then we could be more help.

  5. #5
    Fanatic Member
    Join Date
    Sep 2004
    Location
    Jakarta, Indonesia
    Posts
    818

    Re: Saving the Excel VB

    How can I save the contents in excel without overwriting it but appending it under the same filename?
    u can use RobDog888 method..using xlInsert (sorry can't find the post)
    or
    Code:
    ...
      Set oSheet = newBook.ActiveSheet
      lMaxRowNumber = oSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
      oSheet.Rows(CStr(lMaxRowNumber + 1) & ":" & CStr(lMaxRowNumber + 1)).Select 'to insert at new row..
    ...
    PS : don't forget to change to appropriate name

    1st NF - a table should not contain repeating groups.
    2nd NF - any fields that do not depend fully on the primary key should be moved to another table.
    3rd NF - there should be no dependency between non key fields in same table.
    - E. Petroutsos -


    eRiCk

    A collection of "Laku-abis" Ebook, Permanent Residence

    Access Reserved Words, a Classic Form Bug, Access Limitation, Know run Process and the Lock they hold in, Logging User Activity in MSSQL,
    Kill Database Processes

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Posts
    69

    Resolved Saving the Excel VB

    Thanks guys,

    Managed to solve it yesterday by first creating in temp excel and then use filecopy function.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width