|
-
Dec 14th, 2004, 02:59 AM
#1
Thread Starter
Lively Member
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
-
Dec 14th, 2004, 03:01 AM
#2
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.
-
Dec 14th, 2004, 03:08 AM
#3
Thread Starter
Lively Member
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?
-
Dec 14th, 2004, 03:12 AM
#4
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.
-
Dec 14th, 2004, 04:36 AM
#5
Fanatic Member
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
-
Dec 15th, 2004, 05:16 AM
#6
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|