PC Review


Reply
 
 
Atif
Guest
Posts: n/a
 
      20th Oct 2009
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 With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      20th Oct 2009
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 With Quote
 
Atif
Guest
Posts: n/a
 
      20th Oct 2009
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a streamwriter writing to a network share, is it possible for th Daniel Microsoft Dot NET 1 7th Sep 2005 09:02 AM
System.IO.StreamWriter Close or Flush method to shut down the computer in such a way that just part of the file is written? or an empty file is written? Also if the Close or Flush is to a streamwriter writing to a network share, is it possible for th Daniel Microsoft C# .NET 1 6th Sep 2005 10:55 PM
file wont close so I can close the program down =?Utf-8?B?c2hlcnJ5?= Microsoft Access Database Table Design 1 13th Jun 2005 02:14 PM
Version 6.0-close makes works close and not the file. =?Utf-8?B?TmV3Ymll?= Microsoft Word New Users 0 3rd Oct 2004 03:05 PM
Re: How do you enable the file, close option to close the whole appli. Cindy M -WordMVP- Microsoft Word Document Management 2 28th Sep 2004 01:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:30 PM.