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: 8
Default Opening Closed Worksheets with VBA

Please Help!

It seems like I have tried everything. I have a worksheet with a
module that has the following VBA:

Sub GetFile()
Sheets("Menu").Select
PathName = Range("C1").Value
Filename = Range("C2").Value
TabName = Range("C3").Value
ControlFile = ActiveWorkbook.Name
Workbooks.Open Filename:=PathName & Filename
ActiveSheet.Name = TabName
Sheets(TabName).Copy After:=Workbooks(ControlFile).Sheets(2)
Windows(Filename).Activate
ActiveWorkbook.Close SaveChanges:=False
Windows(ControlFile).Activate
Sheets("Menu").Select
End Sub

When I click the button on the sheet named "Menu" it opens the other
workbook, but grabs the sheet that was last viewed before it was saved
and closed. There are 2 sheets from the workbook I want to copy and
paste when this button is clicked. How do I designate or tell Excel
which exact tab to grab, and can I have 2 of them grabbed at the same
time??

thanks!!!!

 
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
linking worksheets to a closed workbook LLK Excel Worksheet Functions 2 May 16th 08 10:14 PM
Closed toolbars keept re-opening Jo Scrimshire Excel Discussion (Misc queries) 1 April 17th 08 07:10 PM
How to alter content in a closed spreadsheet without opening it! mflibra Excel Discussion (Misc queries) 0 August 17th 06 02:18 AM
Pull Data from a closed workbook, without opening it. Joe B.[_3_] Excel Programming 7 December 31st 03 05:06 PM
Code for Opening a Closed Workbook scrabtree23[_2_] Excel Programming 3 November 11th 03 03:48 PM


All times are GMT +1. The time now is 09:50 PM.

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"