Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post data to closed workbook sheet?

Status
Not open for further replies.

hsviljoen

Programmer
May 26, 2004
73
ZA
I need to post data from one workbook into a sheet in a other workbook. I'm having problems to run any code after the line of code that opens the other workbook.

Does anyone have a idea?

thank you in advance.
 
hsviljoen,

Please post the code that is not working.

Skip,

[red]Be advised:[/red] [glasses]
Alcohol and Calculus do not mix!
If you drink, don't derive! [tongue]
 
Excel.Workbooks.Open (Filename)
----- Any code below the code above does not run ------
Range("A1").Insert

It opens the workbook and then it stops there
 
You need to activate the workbook you have just opened.
Code:
books(Filename).activate
 
You do NOT necessarily need to ACTIVATE anything.
Code:
Set wbk = Excel.Workbooks.Open(filename)

wbk.Worksheets(1).Range("A1").Insert


Skip,

[red]Be advised:[/red] [glasses]
Alcohol and Calculus do not mix!
If you drink, don't derive! [tongue]
 
My Apologies Skip, badly worded on my behalf. You're quite right, no need to actually activate, but there is a need to reference the newly opened book.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top