Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Everytime i close an excel file, it creates a new backup file | Excel Discussion (Misc queries) | |||
Close & save a file at set time only IF the file is open | Excel Programming | |||
Close file and run macro from newly opened file | Excel Programming | |||
VBA - on a button event, open another closed file, post changes, close file | Excel Programming | |||
Automate open file, update links, run macro, close and save file | Excel Programming |