LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Closing Files Opened Using the FileToOpen

Hi Again

I have opened a file successfully (user defined and stored as FileToOpen)
and copied it's content into the active worksheet.
However, since it opens a new instance of Excel, I can't work out how to
close the FileToOpen file, and where the command belongs in the code below.

-----------------------------------------------------------------------------

Worksheets("Imported Data").Visible = True

With Application.FileDialog(msoFileDialogOpen)
FileToOpen = Application _
.GetOpenFilename("Comma Separated Values (*.csv),*.csv,Microsoft
Excel (*.xls),*.xls,All Files (*.*),*.*")
Workbooks.Open FileToOpen
Range("A1").Activate
Application.Run ("'Report Generator v1.xls'!Select_Data")
Selection.Copy
Workbooks("'Report Generator v1.xls").Activate
Sheets("Imported Data").Activate
Range("A1").Select
Selection.Insert Shift:=xlDown

***I assume here I need to switch to the other workbook
(FileToOpen), close it, then switch back to ("Report Generator v1.xls")***

End With
Worksheets("Imported Data").Visible = False
Sheets("Main").Activate
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing a workbook after it has opened another belkingold Excel Programming 5 October 30th 06 06:51 PM
Closing files and saving files dan Excel Worksheet Functions 0 August 15th 06 04:07 AM
Opened Autosave but when closing workbook Autosave closes itself Ken Excel Worksheet Functions 0 October 29th 05 05:11 PM
Excel 2003 when closing Excel after having opened a project locked for viewing.. password prompt??? braindead Excel Discussion (Misc queries) 0 March 25th 05 01:58 PM
closing opened workbook/app in memory Alex Excel Programming 0 January 26th 05 08:35 PM


All times are GMT +1. The time now is 08:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"