database - Reference a cell in another workbook. And make my query not refresh if values are equal -
it says have few parameters expected 15... before , after refresh.
class 1
public withevents qt querytable private sub qt_afterrefresh(byval success boolean) application.worksheets("rawdatalines").range("a1") = application.worksheets("rawdatalines").range("c1") application.run "'operation ipads.xls'!assembly1_button" end sub
class 2
public withevents qut querytable private sub qut_beforerefresh(cancel boolean) worksheets("rawdatalines").range("c1") = _ "='h:\departments\manufacturing\production links\dashboard breakdown\[master_live_status_data.xls]sheet1'!r1c1" if application.worksheets("rawdatalines").range("c1") = application.worksheets("rawdatalines").range("a1") cancel = true end if end sub
initialize:
dim t new class1 dim h new class2 sub initialize_it() set t.qt = thisworkbook.sheets(3).querytables(1) set h.qut = thisworkbook.sheets(3).querytables(1) end sub
private sub qt_beforerefresh(byval success boolean)
the argument cancel
, code refers to. change cancel
.
you can refer current workbook (where code running) thisworkbook
. assuming master one, can use:
thisworkbook.worksheets("sheet1").range("a1")
the workbooks
collection refers open workbooks, need temporarily open other workbook:
dim wbother workbook set wbother = workbooks.open("full path , filename.xlsx", false)
the false
argument indicates not wish update links
when opening book (if appropriate).
when have finished other book, use:
wb.close false 'false says not need save changes set wb = nothing
it possible single value workbook without opening , closing it, if book has links may cause issue:
debug.print executeexcel4macro("'f:\documents , settings\student\my documents\[andysdata7.xlsx]staff list'!r6c4")
note, formula needs use r1c1 notation. (rather debug.print
store value in variable.) note not recommending approach, undocumented, thought i'd mention in context of question.
Comments
Post a Comment