Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default Can I change this to work for a closed workbook

Below is my code which works fine. However, it requires the "Employee
Database.xls" file to already be open. How could I change my code so that it
is pulling this data from a closed "Employee Database.xls" file?

Sub UpdateCodeBook()
'
' Employees Macro
' Macro recorded 9/28/2004 by Shawn D. Crabtree
'
' Keyboard Shortcut: Ctrl+Shift+E


Sheets("Names").Columns("A:C").ClearContents
Windows("Employee Database.xls").Activate
Sheets("Library").Range("C:C,E:E,BE:BE").Copy
ActiveWindow.ActivateNext
Sheets("Names").Select
Range("A1").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.DisplayAlerts = False
Windows("Employee DataBase.xls").Close
Application.DisplayAlerts = True
Sheets("Names").Select
Range("A1").Select
End Sub



--
Thanks
Shawn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Can I change this to work for a closed workbook

You can try saving "Employee Database.xls" as an addin. Then load the
file as an addin. Whenever you open excel the Employee Database will
be open.

A couple of Caveots...

You will need to code a Workbook.Save action in the workbook before
close event of the Employee Database.

Also if multiple users will be working in this file at the same time,
you may need to look into using MS Access instead of excel.

Thanks,
Chuck

Shawn wrote:
Below is my code which works fine. However, it requires the "Employee
Database.xls" file to already be open. How could I change my code so that it
is pulling this data from a closed "Employee Database.xls" file?

Sub UpdateCodeBook()
'
' Employees Macro
' Macro recorded 9/28/2004 by Shawn D. Crabtree
'
' Keyboard Shortcut: Ctrl+Shift+E


Sheets("Names").Columns("A:C").ClearContents
Windows("Employee Database.xls").Activate
Sheets("Library").Range("C:C,E:E,BE:BE").Copy
ActiveWindow.ActivateNext
Sheets("Names").Select
Range("A1").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.DisplayAlerts = False
Windows("Employee DataBase.xls").Close
Application.DisplayAlerts = True
Sheets("Names").Select
Range("A1").Select
End Sub



--
Thanks
Shawn


Reply
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
How do I change a work book number. I always getting workbook 1 Geothemann Excel Discussion (Misc queries) 1 July 16th 09 05:39 PM
INDIRECT should be updated to work on closed workbooks. Robert_L_Ross Excel Worksheet Functions 0 December 4th 07 05:47 PM
INDIRECT function do not work when other file is closed starguy Excel Discussion (Misc queries) 4 May 12th 06 06:57 PM
Is there a work around to use the indirct function with a closed . jimgharrison Excel Worksheet Functions 0 February 9th 05 03:47 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM


All times are GMT +1. The time now is 08:39 PM.

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

About Us

"It's about Microsoft Excel"