Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
formular for finding data and inserting value in seperate column | Excel Discussion (Misc queries) | |||
How to return multiple cells from a data sheet in a seperate workbook | Excel Worksheet Functions | |||
How do I seperate data from a pivot into seperate worksheets? | Excel Discussion (Misc queries) | |||
how do i seperate data from one column into two seperate ones in . | Excel Discussion (Misc queries) | |||
Can Excel open each workbook in a seperate window | Setting up and Configuration of Excel |