copy a variable to clipboard and pass it to an other sub
copy a variable to clipboard and pass it to an other sub
(OP)
dear colleagues...
I am having a very big problem.
Is anybody who knows how can i use the results from a FORM to an other?
I had to create several dialog boxes (forms) and the thing is that i need to pass some results from one to the other... WITHOUT WRITING THE DATA IN ANY CELLS. The data has to be written in the variable and registered to clipboard and call backed form/by an other subroutine.
Thank you very much for all your help.
Florin
I am having a very big problem.
Is anybody who knows how can i use the results from a FORM to an other?
I had to create several dialog boxes (forms) and the thing is that i need to pass some results from one to the other... WITHOUT WRITING THE DATA IN ANY CELLS. The data has to be written in the variable and registered to clipboard and call backed form/by an other subroutine.
Thank you very much for all your help.
Florin





RE: copy a variable to clipboard and pass it to an other sub
case 1
program A pops up form B
some data is entered
user hits a button
program A pops up form C with data entered from form B
case 2
program A pops up form B
program D pops up form C
some data is entered
user hit a button
data is transferred from form B to form C
RE: copy a variable to clipboard and pass it to an other sub
CODE
Clipboard.Clear
Clipboard.SetText Text1.Text
End Sub
Private Sub CmdMyPaste_Click()
Text2.Text = Clipboard.GetText(vbCFText)
End Sub
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints
RE: copy a variable to clipboard and pass it to an other sub
I have a macro. In this macro I am having 2 dialog boxes. One asks the user to input some data. One of the data is the date start and end of a task. In order to do so I've added a button that calls for calendar window.
When the user selects the date and pushes ADD button the date has to be written in the appropriate TextBox (on the main FORM). When the user inserted all data then he hits OK button.
After this all the data in the FORM are written to excel (in specific cells). Until now the only way i've manage to do this is by writing the date into a cell and make the TextBox load it from there.
With all this I am convinced that there should be a way of putting this Date into clipboard and load it to the TextBOX. Afterwards, when OK button is pushed, it will be added to the excel cell.
Those are all the details for this particular task that i have to perform.
Thank you very much.
If you have any idea please do not hesitate.
RE: copy a variable to clipboard and pass it to an other sub
Unfortunately the VBA gives error msg when I am trying to use the sequence you've written.
It does not accept
Clipboard.Clear
Clipboard.SetText Text1.Text
like commends.
I also tried to create a new form (in respect with what u've used)and the error seems to be the same.
Thanks.
Do u have any idea of what is going on?
RE: copy a variable to clipboard and pass it to an other sub
clipboard in VBA is more tricky to use.
try form2.textbox.text = (form1.)textbox.text
Regards,
Regg
RE: copy a variable to clipboard and pass it to an other sub
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376: Eng-Tips.com Forum Policies before posting
Steam Engine enthusiasts
Steam Engine Prints
RE: copy a variable to clipboard and pass it to an other sub
If there are variables in a form that you need to pass along, declare them as Public.
When you hide a form, all of its data is still available. You can query the public variables. It is not until you unload a form that the data is lost.
Below: code from one of my macros that gets data from two form variables before unloading...
CODE
SelFilter = frmFeatureSelection.SelectSum
If Not frmFeatureSelection.OKFlag Then Unload frmFeatureSelection: End
Unload frmFeatureSelection
http://www.EsoxRepublic.com-SolidWorks API VB programming help
RE: copy a variable to clipboard and pass it to an other sub
And.. my apologies for posting it on the wrong forum.
Thank you very much. Now the problem is solved.
It works also with the clipboard as well as by using the public variable.