Using a macro to perform a TASK on another workbook

J

JimKusche

All references I can find describe running a macro that is located in
another workbook. I want to perform a task ON another workbook using a
routine in the current workbook. I can't add the routine to the other book
because it's a datafile(.xls) generated from another program.

Specifally I want to "find" a value and then copy it into the current
workbook.

I can open the workbook but don't seem to be able to perfom any tasks on it.

EtimeFile = "C:\My Documents\Work files\emplabdt.xls" 'used at home
Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open (EtimeFile)
XL.Visible = True

Set paycode = Worksheets([emplabdt.xls]!Sheet1).Columns("A").Find("Pay
Code")
paycode.Select
 
D

Don Guillett

A "brief" look shows that you need to change worksheets to workbooks, etc.
Set paycode =
Worksheets([emplabdt.xls]!Sheet1).Columns("A").Find("PayCode")
Set paycode =
Workbooks("emplabdt.xls").Sheets(1).Columns("A").Find("PayCode")

JimKusche said:
All references I can find describe running a macro that is located in
another workbook. I want to perform a task ON another workbook using a
routine in the current workbook. I can't add the routine to the other book
because it's a datafile(.xls) generated from another program.

Specifally I want to "find" a value and then copy it into the current
workbook.

I can open the workbook but don't seem to be able to perfom any tasks on it.

EtimeFile = "C:\My Documents\Work files\emplabdt.xls" 'used at home
Set XL = CreateObject("Excel.Application")
XL.Workbooks.Open (EtimeFile)
XL.Visible = True

Set paycode = Worksheets([emplabdt.xls]!Sheet1).Columns("A").Find("Pay
Code")
paycode.Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top