ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Returning to original workbook (https://www.excelbanter.com/excel-programming/304825-re-returning-original-workbook.html)

Jim Cone

Returning to original workbook
 
Anthony,

Dim OldBook as Excel.Workbook
Set OldBook = ActiveWorkbook
'your code
OldBook.Activate


Regards,
Jim Cone
San Francisco, CA

"Anthony Byrne" wrote in message ...
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
ScreenUpdating = False
Columns("a:K").Copy
Range("B1").Select
Set NewBook = Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues
Selection.PasteSpecial Paste:=xlPasteFormats
Selection.PasteSpecial Paste:=xlPasteColumnWidths
Range("A1").Select
Application.CutCopyMode = False
Do
fName = Application.GetSaveAsFilename
Loop Until fName < False
NewBook.SaveAs Filename:=fName

With ActiveWindow
.DisplayGridlines = False
.DisplayOutline = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = True
End With
End Sub
In the above programme how do I return to the original workbook?




All times are GMT +1. The time now is 12:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com