Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Inserting data into a seperate Excel workbook

If it is acceptable to open Workbook B, insert the data and close it at the
speed of light, without the user seeing any change then you can use something
like:

Sub InsertData()
Dim strFile as String
strFile = "xxx"
Application.ScreenUpdating=False
With Workbooks
.Open(strFile)
'your code to insert data
.Range("MyDestinationRange")="Hello"
.Close True
End with
End Sub

"Jon" wrote:

All,
I am interested in having a macro from Excel Workbook A insert data into
seperate and unopened Workbook B. Workbook B's name will vary. Is this
possible and if so how should I go about it? Thanks in advance.
--
J

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Inserting data into a seperate Excel workbook


gocush wrote:
If it is acceptable to open Workbook B, insert the data and close it

at the
speed of light, without the user seeing any change then you can use

something
like <snip


Often it takes a little longer to open a workbook <g. Here is the ADO
equivalent for a *closed* workbook:

Sub jtest()
Dim strFile As String
strFile = "xxx"
Dim con As Object
Set con = CreateObject("ADODB.Connection")
With con
..Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Extended Properties='Excel 8.0;HDR=NO';" & _
"Data Source=" & strFile
..Execute "UPDATE MyDestinationRange SET F1 = 'Hello';"
..Close
End With
End Sub

Jamie.

--

  #3   Report Post  
Posted to microsoft.public.excel.programming
Jon Jon is offline
external usenet poster
 
Posts: 183
Default Inserting data into a seperate Excel workbook

Hmmm, just copied/pasted the code into the editor and got an error stating
"Compile Error: Expected: Identifier or bracketed expression"

Any ideas on what this is from? Thanks in advance.

"onedaywhen" wrote:


gocush wrote:
If it is acceptable to open Workbook B, insert the data and close it

at the
speed of light, without the user seeing any change then you can use

something
like <snip


Often it takes a little longer to open a workbook <g. Here is the ADO
equivalent for a *closed* workbook:

Sub jtest()
Dim strFile As String
strFile = "xxx"
Dim con As Object
Set con = CreateObject("ADODB.Connection")
With con
..Open _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Extended Properties='Excel 8.0;HDR=NO';" & _
"Data Source=" & strFile
..Execute "UPDATE MyDestinationRange SET F1 = 'Hello';"
..Close
End With
End Sub

Jamie.

--


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
formular for finding data and inserting value in seperate column Frabj Excel Discussion (Misc queries) 2 November 28th 08 08:03 PM
How to return multiple cells from a data sheet in a seperate workbook [email protected] Excel Worksheet Functions 19 June 27th 07 10:27 PM
How do I seperate data from a pivot into seperate worksheets? Shannon Excel Discussion (Misc queries) 5 August 25th 05 06:07 AM
how do i seperate data from one column into two seperate ones in . Nikki Excel Discussion (Misc queries) 2 March 30th 05 08:31 PM
Can Excel open each workbook in a seperate window JVC Dude Setting up and Configuration of Excel 2 January 15th 05 01:01 AM


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