LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Exporting to several xls files

Chip and Tom

Thanks a lot, its working just like i hoped.

Many thanks,
Ole

"Chip Pearson" skrev i en meddelelse
...
Ole,

bk should be declared as Workbook (singular) not Workbooks
(plural).

Dim bk As Workbook

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"ole_" wrote in message
...

"Chip Pearson" skrev i en meddelelse
...
Ole,

The problem is likely cause by line breaks in Tom's otherwise
correct reply. The code

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

should be on a single line of code in the editor. Or, you can
use
the line continuation character to split it in to two lines:

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


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



Hi Chip,

Now i get another error:

"Compile error: ethod or data member not found" and then
".worksheets" in
bk.worksheets(1).Range("C1:C5").Value = _
is highlighted, here is what i have so far:

Private Sub Workbook_BeforeClose(Cancel As Boolean)

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:\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

End Sub


And something else i have been wondering, shouldent the
master.xls open??

Regards,
Ole






 
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
Exporting to seperate .ini files Gunti Excel Discussion (Misc queries) 0 June 25th 09 03:15 PM
EXPORTING EXCEL FILES drwho New Users to Excel 0 February 9th 09 09:16 PM
exporting pdf files to excel Walter Davis[_2_] New Users to Excel 2 June 19th 08 08:54 AM
Exporting delimited files Greegan Excel Worksheet Functions 1 April 14th 05 08:02 AM
Exporting CSV files Hank Myers Excel Programming 1 December 2nd 03 08:33 PM


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