Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Eport Excel data to closed Excel Workbook

Is it possible to export data from the active workbook to a closed Excel
workbook. I would like to do this monthly to a different sheet each time. I
know to import data the range has to be named so i assume it is the same
priciple.

If this is possible i would greatly appreciate the relevant code

--
with kind regards

Spike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Eport Excel data to closed Excel Workbook

Yes i am trying to avoid opening it, and thought ADO or DAo would do the job
as oppposed to copy etc but guess i will have to go downt that route then
--
with kind regards

Spike


"Barb Reinhardt" wrote:

The workbook may be closed to begin with, but I suspect you'll have to open
it to import and save your date. That can be done programmatically. Is
that what you mean?

"Spike" wrote:

Is it possible to export data from the active workbook to a closed Excel
workbook. I would like to do this monthly to a different sheet each time. I
know to import data the range has to be named so i assume it is the same
priciple.

If this is possible i would greatly appreciate the relevant code

--
with kind regards

Spike

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Eport Excel data to closed Excel Workbook

The workbook may be closed to begin with, but I suspect you'll have to open
it to import and save your date. That can be done programmatically. Is
that what you mean?

"Spike" wrote:

Is it possible to export data from the active workbook to a closed Excel
workbook. I would like to do this monthly to a different sheet each time. I
know to import data the range has to be named so i assume it is the same
priciple.

If this is possible i would greatly appreciate the relevant code

--
with kind regards

Spike

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Eport Excel data to closed Excel Workbook

you can read/write to excel workbooks as if to a daabase...here's some simple
code - no error trapping - to give you the idea...the spreadsheet named as
database has a nambed range, "testdata" on sheet1

Sub WriteData()
Dim Conn As ADODB.Connection
Dim strConn As String
Dim sExcelSourceFile As String

sExcelSourceFile = "E:\Excel\Excel_database\Testdatabase.xls"

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel
8.0;"
strConn = strConn & "Data Source="
strConn = strConn & sExcelSourceFile

Set Conn = New ADODB.Connection
Conn.Open strConn

With New Command
.ActiveConnection = Conn
.CommandText = "INSERT into testdata ([KEYV],[PROD],[COST])values(
..999,'X',.888)"
.CommandType = adCmdText
.Execute
End With

Conn.Close
Set Conn = Nothing
End Sub


"Spike" wrote:

Is it possible to export data from the active workbook to a closed Excel
workbook. I would like to do this monthly to a different sheet each time. I
know to import data the range has to be named so i assume it is the same
priciple.

If this is possible i would greatly appreciate the relevant code

--
with kind regards

Spike

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Eport Excel data to closed Excel Workbook

That looks extremely helpful i am most grateful
--
with kind regards

Spike


"Patrick Molloy" wrote:

you can read/write to excel workbooks as if to a daabase...here's some simple
code - no error trapping - to give you the idea...the spreadsheet named as
database has a nambed range, "testdata" on sheet1

Sub WriteData()
Dim Conn As ADODB.Connection
Dim strConn As String
Dim sExcelSourceFile As String

sExcelSourceFile = "E:\Excel\Excel_database\Testdatabase.xls"

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Excel
8.0;"
strConn = strConn & "Data Source="
strConn = strConn & sExcelSourceFile

Set Conn = New ADODB.Connection
Conn.Open strConn

With New Command
.ActiveConnection = Conn
.CommandText = "INSERT into testdata ([KEYV],[PROD],[COST])values(
.999,'X',.888)"
.CommandType = adCmdText
.Execute
End With

Conn.Close
Set Conn = Nothing
End Sub


"Spike" wrote:

Is it possible to export data from the active workbook to a closed Excel
workbook. I would like to do this monthly to a different sheet each time. I
know to import data the range has to be named so i assume it is the same
priciple.

If this is possible i would greatly appreciate the relevant code

--
with kind regards

Spike

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
importing data from closed Excel workbook SteveC Excel Programming 2 March 12th 08 02:33 AM
Excel Form data to closed workbook don Excel Programming 0 July 17th 07 09:16 AM
how to eport health level 7 data to excel gm New Users to Excel 1 April 14th 06 10:33 PM
ADO - recordset - closed excel workbook graham d Excel Programming 9 October 21st 04 04:08 PM
how to run macro of closed excel workbook using VBA santoshkumar Excel Programming 3 November 10th 03 02:23 PM


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