i have create macro for both excel and word, so there is 2 macro will be running Simultaneously, my problem is these 2 macro must be able to passing value to each other, is any method to do that?
Printable View
i have create macro for both excel and word, so there is 2 macro will be running Simultaneously, my problem is these 2 macro must be able to passing value to each other, is any method to do that?
The easiest way would be to store the value in a file and read it out of the file.
But why don't you use a single macro for both projects, if it is started by Excel, word could be opened by the macro, that way you would have direct access to the values!!
If you give more detail, we could help!
thanks...is this the only solution?
the project i going to do is like this...
The macro is start from excel to generate a customized table in a sheet, but in word document will have a another macro(activate by a command button in word document) to call out something like reference table(generated by user form), if the user click on a cell in this reference table, a repective value will be copy to this word document, this is easy for user to create a word document, and all the value from this reference table is take from excel workbook.
In my case, is single macro able to handle all the task?
When do you create this Workbook, when does it get changing entries?Quote:
Originally Posted by lighthouse
It looks to me as if you would only need the Word-macro that does the stuff with the reference table. In order to get the values from the Excel-workbook into your Word-macro you need to create an Excel-object, open the workbook and read the values.
the table in workbook is create by macro and can be customized by user.
i never think about that macro in word document can read the value from an excel, i'll try to do in this way...is a macro in word document can fully control an excel workbook?
that's another question have to ask, do i able to create a control(label, command button) at run time in VBA same like in VB? i tried it quite a long time but can get any command to do that.
the code will vary depending where you want to put the controls, on a form, toolbar or in the document? do you already have form?
buttons on a form are not the same as in the document, and toolbar buttons are different again
I already have a form, so i intend to put the controls on the form.
Somemore there is a multipage on my form, and each page will have a frame, the controls will be put on certain frame on a certain page, is possible to do that?
it is quite easy to create a new control, but in vba there is no way i know to set the container to be the frame as you can with VB controls
you may have to just set the controls as visible or not depending which frame is showing
vb Code:
Dim c As CommandButton Set c = UserForm1.Controls.add("Forms.CommandButton.1", "cmdtest", True)