Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform Question Posted Again
if the buttons are in the second workbook, then you can't refer to the
userform in the first workbook from the code in the second workbook. It is possible, but you have to call code in the first workbook that passes a reference to the userform to the second workbook using a function. It is unclear why you would go to a second workbook and click a button to select what is populated in the userform. the normal way would be to have a combobox in the userform that lists company names, then when one is selected, code in the userform would gather the data from the second workbook. -- Regards, Tom Ogilvy "Ryan" wrote in message ... On my userform, there is a command button that goes to a worksheet in another workbook. This new worksheet serves as a sort of database for companies. Each company is listed in a row with a commandbutton to the left of the company information that will populate the userform from the first workbook. I am having problem with my code for this action: Private Sub CommandButton1_Click() Workbooks("Workflow Engine").Worksheets("FLAT DIP(S)").Activate Unload UserForm12FLATDIPSAppraisal UserForm12FLATDIPSAppraisal.TextBox2.Text = Workbooks("CARDEX TEST").Sheets("AppraisalCardex").Range("C3") UserForm12FLATDIPSAppraisal.TextBox3.Text = Workbooks("CARDEX TEST").Sheets("AppraisalCardex").Range("D3") UserForm12FLATDIPSAppraisal.TextBox4.Text = Workbooks("CARDEX TEST").Sheets("AppraisalCardex").Range("F3") UserForm12FLATDIPSAppraisal.TextBox5.Text = Workbooks("CARDEX TEST").Sheets("AppraisalCardex").Range("E3") UserForm12FLATDIPSAppraisal.TextBox6.Text = Workbooks("CARDEX TEST").Sheets("AppraisalCardex").Range("B3") UserForm12FLATDIPSAppraisal.Show End Sub The problem occurs when I Unload the Userform. I have exhausted my knowledge of VBA (which took all of 30 sec.) and I can't figure out how to fix this problem. I had this working perfectly when the database of companies was part of the original workbook. My boss decided that he wanted the users to have the appearance of not leaving the screen, so that is why I am trying to use this other workbook. Another question that I have is can you set the size of a window in VBA? Because I would like to be able to set how big the database workbook is so that users feel like they never left the original workbook screen. Ryan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Question not posted? | New Users to Excel | |||
How do I find a question I posted yesterday? | Excel Discussion (Misc queries) | |||
Please can someone look at question i posted yesterday | Excel Worksheet Functions | |||
How do I get back to a question I've posted? | Excel Discussion (Misc queries) | |||
How do I find a question I posted last week? | Excel Discussion (Misc queries) |