Hey guys I'm trying to pull together data from several workbooks. To do this I have to modify every submitting workbook (show hidden columns etc). There are apx 100 subsequent submitting files to open, processing and close In the macro I open the files as "read only" to prevent unwanted actions. My problem is that a message "Will you save this file" appears at the ActiveWorkbook.Close macro VBA statement when the file is to close after ended action. Of course I can push the "no" button every singel time - but I expect the must be a way to make my macro close the file without saving it and without messaging. All the rest of my macro seems to work well. Will any one "out there" please give me some exact advice to eliminate this problem? Best regards Snoopy
try: ActiveWorkbook.Close savechanges:=false Snoopy wrote: > > Hey guys > I'm trying to pull together data from several workbooks. > To do this I have to modify every submitting workbook (show hidden > columns etc). There are apx 100 subsequent submitting files to open, > processing and close > In the macro I open the files as "read only" to prevent unwanted > actions. > > My problem is that a message "Will you save this file" appears at > the > ActiveWorkbook.Close macro VBA statement when the file is to close > after ended action. > Of course I can push the "no" button every singel time - but I expect > the must be a way to make my macro close the file without saving it > and without messaging. > > All the rest of my macro seems to work well. > > Will any one "out there" please give me some exact advice to eliminate > this problem? > > Best regards > Snoopy -- Dave Peterson
Try putting this line before you close the file: Application.DisplayAlerts = False and this one after: Application.DisplayAlerts = True Hope this helps. Pete On Aug 26, 1:54 pm, Snoopy wrote: > Hey guys > I'm trying to pull together data from several workbooks. > To do this I have to modify every submitting workbook (show hidden > columns etc). There are apx 100 subsequent submitting files to open, > processing and close > In the macro I open the files as "read only" to prevent unwanted > actions. > > My problem is that a message "Will you save this file" appears at > the > ActiveWorkbook.Close macro VBA statement when the file is to close > after ended action. > Of course I can push the "no" button every singel time - but I expect > the must be a way to make my macro close the file without saving it > and without messaging. > > All the rest of my macro seems to work well. > > Will any one "out there" please give me some exact advice to eliminate > this problem? > > Best regards > Snoopy
On 26 Aug, 15:21, Pete_UK wrote: > Try putting this line before you close the file: > > Application.DisplayAlerts = False > > and this one after: > > Application.DisplayAlerts = True > > Hope this helps. > > Pete > > On Aug 26, 1:54 pm, Snoopy wrote: > > > > > Hey guys > > I'm trying to pull together data from several workbooks. > > To do this I have to modify every submitting workbook (show hidden > > columns etc). There are apx 100 subsequent submitting files to open, > > processing and close > > In the macro I open the files as "read only" to prevent unwanted > > actions. > > > My problem is that a message "Will you save this file" appears at > > the > > ActiveWorkbook.Close macro VBA statement when the file is to close > > after ended action. > > Of course I can push the "no" button every singel time - but I expect > > the must be a way to make my macro close the file without saving it > > and without messaging. > > > All the rest of my macro seems to work well. > > > Will any one "out there" please give me some exact advice to eliminate > > this problem? > > > Best regards > > Snoopy Skjul sitert tekst > > Vis sitert tekst Thanks a lot :)
On 26 Aug, 15:19, Dave Peterson wrote: > try: > > ActiveWorkbook.Close savechanges:=false > > > > > > Snoopy wrote: > > > Hey guys > > I'm trying to pull together data from several workbooks. > > To do this I have to modify every submitting workbook (show hidden > > columns etc). There are apx 100 subsequent submitting files to open, > > processing and close > > In the macro I open the files as "read only" to prevent unwanted > > actions. > > > My problem is that a message "Will you save this file" appears at > > the > > ActiveWorkbook.Close macro VBA statement when the file is to close > > after ended action. > > Of course I can push the "no" button every singel time - but I expect > > the must be a way to make my macro close the file without saving it > > and without messaging. > > > All the rest of my macro seems to work well. > > > Will any one "out there" please give me some exact advice to eliminate > > this problem? > > > Best regards > > Snoopy > > -- > > Dave Peterson Skjul sitert tekst > > Vis sitert tekst Thanks to you both - it really did the job :)
You're welcome - thanks for feeding back. Pete On Aug 26, 2:28 pm, Snoopy wrote: > > Thanks a lot