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: 1
Default Rename closed workbook


I AM USING

sub file_in_network_folder()
application.screenupdating = false
on error resume next

'call the macro getrange
getrange \"c:\data\\"test.xls\", \"test\", \"a1:h180\", _
sheets(\"sheet1\").range(\"bb2\")

on error goto 0
application.screenupdating = true
end sub

sub getrange(filepath as string, filename as string, sheetname as
string, _
sourcerange as string, destrange as range)

dim start

'go to the destination range
application.goto destrange

'resize the destrange to the same size as the sourcerange
set destrange = destrange.resize(range(sourcerange).rows.count, _
range(sourcerange).columns.count)

'add formula links to the closed file
with destrange
..formulaarray = \"='\" & filepath & \"/[\" & filename & \"]\" &
sheetname _
& \"'!\" & sourcerange

'wait
start = timer
do while timer < start + 2
doevents
loop

'make values from the formulas
..copy
..pastespecial xlpastevalues
..cells(1).select
application.cutcopymode = false
end with



TO GET DATA I NEED FROM A CLOSED WORKBOOK.
BUT I NEED TO RENAME THE CLOSED WORKBOOK TO THE CURRENT NAME WITH A
DATE STAMP ON THE END.





I ALSO AM USING

private sub workbook_beforeclose(cancel as boolean)
with activeworkbook
..saveas filename:=.path & \"\\" &
..worksheets(\"sheet1\").range(\"p1\").value, _
fileformat:=xlworkbooknormal
end with
end sub


TO CLOSE A WORKBOOK, BUT I NEED TO CLOSE IT AS READ ONLY.



thank for any info.


--
wally
------------------------------------------------------------------------
wally's Profile: http://www.excelforum.com/member.php...o&userid=36088
View this thread: http://www.excelforum.com/showthread...hreadid=558702

 
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 Hidden Workbook when Active Workbook is Closed SusanK521 Excel Programming 5 September 24th 05 12:27 AM
Rename a new workbook Jan Eric Nilsson Excel Programming 2 July 17th 05 02:36 AM
How can I rename a Workbook? Mac Lingo[_2_] Excel Programming 2 April 23rd 05 09:24 PM
copy worksheet from closed workbook to active workbook using vba mango Excel Worksheet Functions 6 December 9th 04 07:55 AM
Rename a workbook! aiyer[_22_] Excel Programming 1 May 12th 04 05:12 PM


All times are GMT +1. The time now is 02:37 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"