>Hi,
>Does anyone have sample code to 1) open an excel spreadsheet, 2) gather the contents of a range, 3) close the spreadsheet, and repeat the process in a loop? I had partial success until Excel starting a dialog asking me if I want to save the spreadsheet. I didn't change anything, so I don't know why it would ask. I tried issuing a command to save before I quit, but that didn't work. I don't know how to either respond to that dialog, or prevent it from appearing in the first place. Any and all help would be appreciated.
>
>Thanks,
>Don Pieta
After inserting data, Excel will consider the data as "changed", even if all changes have been done through Automation. You have to inform Excel that "there are no changes".
Quoting from my article on Excel Automation (
http://www.levelextreme.com/Magazine/September2002/Page45.asp):
"To mark a spreadsheet as not modified, use the following command (assuming our initial example): oSheet.Parent.Saved = xlTRUE (where xlTRUE is defined as -1). "Parent" refers to the file (workbook), which is the parent of the current spreadsheet."
HTH,
Hilmar.
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)