View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ole_ ole_ is offline
external usenet poster
 
Posts: 30
Default Exporting to several xls files


"Tom Ogilvy" skrev i en meddelelse
...
You can use the Beforeclose event.

Chip Pearson has general information on Events:

http://www:cpearson.com/excel/vbe.htm

in the event you would have something like

Dim bClose as Boolean
Dim bk as workbooks
On Error Resume Next
set bk = workbooks("Master.xls")
On Error goto 0
if bk is nothing then
bClose = True
set bk = Workbooks.Open("C:\Myfolder\Master.xls")
end if
bk.worksheets(1).Range("C1:C5").Value =
worksheets(1).Range("A1:A5").Value
bk.Save
if bClose then
bk.Close Savechanges:=False
End if
Application.EnableEvents = False
thisworkbook.Save
Application.EnableEvents = True


Hi Tom,

I have tried to put it in "this workbook", but it failed at:

bk.worksheets(1).Range("C1:C5").Value =

Is it me there is doing anything wrong?

Regards,
Ole