PDA

View Full Version : Add-in question



Daniel2001
02-12-2008, 01:42 AM
Hi,

I have a workbook, named wrk1 ,getting data updated via Addin ( from database). This workbook run fine manually.

But when I use wrk2 to open wrk using following code


workbooks.open("wrk1.xls")


wrk1 is opened,and executed (code is in workbook_open()),but data not updated....does it has anything to do with Add-in limitation ?

Thans for any advice!

Bob Phillips
02-12-2008, 11:28 AM
Can you post a bit more detail?

Daniel2001
02-22-2008, 04:05 AM
Thanks xld

Here is the detail.

my guess is the Reference problem in VBA.

there are two workbooks, wbk1 and wbk2 ,both contains vba code


application.run "ewupdateall"
'code to generate graph based on the data

in the workbook_open event


"ewupdateall "is an Add-in from Financial database. When I open wbk1 or wbk2 seperately manually. both of them work fine.

Problem arises when I creat a "master" workbook to open wbk1 and wbk2 one by one. only one workbook (say wbk1) updates data, wbk2 also opened,and run,but not update new data.Looks like the the code application.run "ewupdateall" doesn't work in wbk2

code in "master" workbook is:

sub wkb1()
workbooks.open (path of wkb1)
activeworkbook.save
activeworkbook.close
application.ontime now+timevalue("00:00:30"), "wbk2"
end sub
sub wbk2()
workbooks.open (path of wkb1)
activeworkbook.save
activeworkbook.close
end sub


weird thing is that , no matter i run wbk1 or wkb2 first , it is always wbk1 updates data! the code inside wkb1 and wkb 2 are same basically!
any idea?