userform

How to add check boxes to a user form dynamically through a loop in VBA?

我只是一个虾纸丫 提交于 2019-12-11 05:39:10
问题 Add Check Box to UserForms Dynamically through code I am trying to collect all file names in a specific folder in multiple check boxes in a user form so that i can select one by one to move to another folder....after adding one check box i couldn't add another during run time please help. Private Sub Download_file_Click() Dim wrkbk As Workbook Dim ofs As New FileSystemObject Dim ofolder As Folder Dim ofile As File Dim mars_path As String Dim chkBox As MSForms.CheckBox Dim files_count As

Support needed with vba programming for a pop up calendar

我们两清 提交于 2019-12-11 05:29:12
问题 I have no experience with vba and would much appreciate your assistance with the implementation of a pop-up calendar user form. This link will direct you to the source of the calendar that I am trying to introduce into my workbook: http://www.ozgrid.com/forum/showthread.php?t=142603 I have copied the class module, the user form, and the module into my workbook. When I launch the macro, this opens up a user form where i can select the date wished on a calendar. What I miss is to be able to

Userform control error: object invoked has disconnected from its clients

喜夏-厌秋 提交于 2019-12-11 05:14:06
问题 I have a userform with 2 frames. Each frame has a command button that adds a frame to that parent frame. On the first command button click event the addition is successful, but on the 2nd I get an error. Private Sub frame1Button_Click() 'add frame to frame 1 Set frm = Me.Frame1.Controls.Add("Forms.Frame.1", "1") End Sub Private Sub frame2Button_Click() 'add frame to frame2 - this generates error Set frm = Me.Frame2.Controls.Add("Forms.Frame.1", "2") End Sub The error is: description:

Win 10 Excel 2016 Unexplained PixelsToPoints coefficient to position UserForm

浪子不回头ぞ 提交于 2019-12-11 05:07:34
问题 Preambule When trying to position a UserForm at a particular Pixel position (stored in a POINTAPI Type structure), one must convert the Pixel coordinates to Point coordinates to be able to set the UserForm.Left and UserForm.Top VBA properties. Let's call this coefficient K. From my tests, I came to understand that in my case, GetWindowRect and the VBA positioning properties of a UserForm ( Left , Top , Width , Height ) includes the shadows around the window (of class "ThunderDFrame")

VBA_Populate userform data by insert rows in between cells based on the Matching text

被刻印的时光 ゝ 提交于 2019-12-11 04:59:02
问题 In my excel document I have the following Information: I want to automatically populate my userform data to new rows(in between cells), so when we type "Text from Remark" column in the userform TextBox it automatically Find the match and populate data in a new row below the "Text from Remark". Example: When I enter "Hys(row 4)" in the Userform Texbox, the Code should find "Hys" and Transfer the new data below "Hys" with a new row(row 5) and the same repeated again when new data is entered.

Can't set Userform.KeyPreview to true

假如想象 提交于 2019-12-11 04:47:38
问题 I've built a form in Excel. It consists of 3 command buttons and a frame containing checkboxes. The checkboxes are dynamically populated at userform_initialize based on tables in an excel sheet (the idea being easy user customization). The reason for the frame is that there can be a lot of checkboxes and I want the user to be able to scroll through them. My goal now is to create keyboard shortcuts for the form. Where I get stuck is that I can't brute force write KeyDown handlers for each of

Check if nested control is outside parent control range

て烟熏妆下的殇ゞ 提交于 2019-12-11 04:29:10
问题 I have added drag-drop functionality to an image control that is nested inside a Frame Control in my Excel userform. I am trying to prevent the nested image control from being moved outside of the parent control. I was thinking of using an IF statement in a BeforeDropOrPaste event to exit all running macros (so the mousemove event) if the position is outside the range of the parent control. How do I compare the drop location of the control to the range of the parent control? What I think the

VBA: WithEvents puzzle

女生的网名这么多〃 提交于 2019-12-10 18:05:34
问题 I have a UserForm, xForm , that is being instantiated in a class module (let's say TestClass ) as: 'TestClass Dim Form as New xForm Private WithEvents EvForm as MSForms.UserForm Set EvForm = Form At the class module of the xForm itself I have some code that must be executed on Form Closing, ONLY if the form actually closes: 'xForm class module Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) 'Do some cleanup, otherwise the app would hang 'If not closing, don't cleanup

Dynamically define the events of the checkboxes in VBA

放肆的年华 提交于 2019-12-10 11:39:58
问题 I have defined dynamically the checkboxes for my UserForm. See the code: If rs.EOF = False Then i = 1 Do Until rs.EOF Or i = 6 With frmOne.Controls("Version" & i) .Visible = True .Caption = rs!versNo & "#" & rs!Vers_From .tag = rs!versNo & "_" & rs!noID & ".pdf" End With i = i + 1 rs.MoveNext Loop End If Well, for these checkboxes I need a "Click"-Event. For example: Private Sub Version1_Click() If FilterOk = True Then VersNr = Mid(frmOne.Version1.tag, 1, InStr(frmOne.Version1.tag, "_") - 1)

Excel - VBA : pass variable from Sub to Userform

假装没事ソ 提交于 2019-12-10 03:22:36
问题 I have read and applied solution I found on similar topics but nothing seem to work in my case. So, I want to pass a variable from one sub of my Module1 to a userform. It's a string called "provinceSugg". Here is the relevant part of my code : Public provinceSugg As String Sub probaCity() [...] If province = "" And city <> "" Then provinceSugg = sCurrent.Cells(p, db_column).Offset(0, 1).Value UserForm2.Label1 = "Do you mean " & city & " in " & provinceSugg & " ?" UserForm2.Label1.TextAlign =