Close file
Sub CopyPastInMasterTrackingWB()
Dim FName As Variant
ChDir _
"\\officeSCCHOME1.office.adroot.bmogc.net\UserData $\atanvee\home\Development\"
FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls),
*.xls")
Set wb = Workbooks.Open(FName)
If FName < False Then
Workbooks.Open (FName)
Range("A2:AM999").Select
Selection.Copy
Windows("temp OTHR Backlog Reduction - MASTER TRACKING
WORKBOOK.xls").Activate
Range("A1").Select
Selection.End(xlDown).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End If
wb.Close False (error 424 - object required)
its giveing error at wb.close
any how following code worked for me:
Application.DisplayAlerts = False
Windows(2).Activate
ActiveWindow.Close
Thank you! I will like to know whats worng in wb.close
"Jacob Skaria" wrote:
Try the below
Dim wb as Workbook
FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls")
Set wb = Workbooks.Open (FName)
'copy paste code here
wb.Close False
If this post helps click Yes
---------------
Jacob Skaria
"Atif" wrote:
using code I am a opening a worksheet (source), copying data & pasting in
worksheet (target). Target file contains code as well.
My requiredment is after copy/pasting, the source file automatically close,
keep in mind source filename keeps changing.
folloiwng code opens file
ChDir _
"\\ccgrp2.office.adroot.gc.net\OCt\Desktop Deployment\Backlog FY09
Project\Received Inventory Files\"
FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls),
*.xls")
Regards
|