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 [hlp]: How to copy a sheet to new wkbook and close the var at the end


Hi

I'm developing an Excel VBA procedure and I need some support.
I believe I'm doing a very basic error...

WHAT AM I DOING?
I'm opening an excel workbook and link it to a workbook variable type,
then I'm copying a sheet to a new book and *trying* to link it to a new
workbook variable type

At the moment I can do this with the piece of code at the buttom, but I
believe that this is not the best way to do it.

WHY?
Because, this procedure is causing me some troubles at the end.

What happens in the last line of the code is that, besides I don't have
any error, at the end of the procedure the workbook stills open in the
memory and it should be deleted from the memory with the -Set ... =
nothing-.



Code:
--------------------
Set wkInterligBook = Workbooks.Open(sFullPathToInterligFile)

wkInterligBook.Sheets(sIcTID).Copy
wkInterligBook.Close
Set wkInterligBook = Nothing

Set wkInterligBook = ActiveWorkbook
wkInterligBook.SaveAs sFullPathToFinalFile

(...)

wkInterligBook.Save
wkInterligBook.Close
Set wkInterligBook = Nothing
--------------------


Can someone please point me to the right direction.
Many thanks.
P&V


--
pao_e_vinho
------------------------------------------------------------------------
pao_e_vinho's Profile: http://www.excelforum.com/member.php...o&userid=21360
View this thread: http://www.excelforum.com/showthread...hreadid=554625

 
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
Update Cell in WKBook 1 From WkBook 2 pattlee Excel Discussion (Misc queries) 2 May 25th 08 01:27 PM
How do I make sure my Wkbook is accessible to users using earlier Mifty Excel Discussion (Misc queries) 1 May 12th 08 01:30 PM
How to link to a single wksheet in a wkbook that has comments RedRobyn Excel Discussion (Misc queries) 1 June 27th 06 07:40 PM
how do i create a dialog box to appear on opening an excel wkbook lallyboo Excel Discussion (Misc queries) 1 October 13th 05 06:52 PM
Can changes to a worksheet be applied to all wksheets in wkbook? SandyM Excel Worksheet Functions 1 September 18th 05 06:21 PM


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