![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 473
|
In the following code example
I am saving a workbook in directory Q:NEWQUOTESYSTEMQUOTES then taking information from three cells to produce the filename. As it stands the workbook is saved OK but then remains open even though I have opened another workbook in the macro. I want to save the workbook and then close the workbook ignoring any save as prompts etc. Thanks Ted Sub CopySheetSave() ' ' CopySheetSave Macro ' Macro recorded 03/03/2002 by Ted Pratt ' 'Save the quote ActiveWorkbook.SaveAs Filename:="Q:NEWQUOTESYSTEMQUOTES" & Range("H1").Value & Range("I1").Value & Range("J1").Value 'This is where I want to close the above workbook 'After the save open mster sheet Workbooks.Open Filename:="Q:NEWQUOTESYSTEMMasterQuoteSheet2.xls" End Sub |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
ActiveWorkbook.Close where you indicated it should go. Or change the line ActiveWorkbook.SaveAs Filename:="Q:NEWQUOTESYSTEMQUOTES" & Range("H1").Value & Range("I1").Value & Range("J1").Value to ActiveWorkbook.Close SaveChanges:=True, Filename:="Q:NEWQUOTESYSTEMQUOTES" & Range("H1").Value & Range("I1").Value & Range("J1").Value HTH, Jay |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 473
|
Works fine.
Thanks Jay |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|