Dear (vba) programmers,
I am building a dynamic filter in excel (with vba and ActiveX controls).
I would like to use the Microsoft Date and Time Picker Control, Version 6.0 in Excel 2010.
When I generate a drop down calendar with:
Set OLEObj = Sheets("Blad3").OLEObjects.Add(ClassType:="MSComCtl2.DTPicker.2", Link:=False, DisplayAsIcon:=False, Left:=10, Top:=10, Width:=123, Height:=40)
It is placed correctly, but it doesn't function. When I toggle developers mode on and off it functions all of the sudden. This seems like a bug to me or do I have to activate the object or something like that??
I have the same problem as the "first strange thing" of:
http://www.ozgrid.com/forum/showthread.php?t=47290
Hopefully there is someone with the answer.
Thank's in advance!
Yes.. This is a problem with mscomctl control in Windows. If the mscomctl.ocx is not registered in system32 folder then your Excel won't support that date picker.
You can create customized Date Picker and that won't need any such control as it will be totally a userform with different objects.
Check out this video to see how it looks like:
How to Create This?
Create a excel calender in a excel sheet using formulas. Check this video to see how to do it.
Then, create a Userform. Add Labels for each day and headers.
Set caption of these Labels to cell reference.
On label click event - change bgcolor of that label and save value in it's caption.
Rest it is self explanatory if you watch both videos carefully.
If you don't want to create your own date picker then you need to put mscolctl.ocs in system32 folder and execute batch command to execute it.
Once it is there click START>RUN and type REGSVR32 MSCOMCTL.OCX
Related
I want to know how we can inject excel data into embed powerpoint chart.
Any information that I search taught me how to do it, but with create new presentation. I need to update the existing chart from powerpoint using data from excel.
And the method should not be update link or something. Because I deal with more than hundred charts, I'm afraid linked method will take huge resource that cannot handle by my device. The other reason is I need to keep the chart editable in powerpoint (something that cannot done with paste link method).
Any suggestion?
Thanks
it depends of the version of you office. I have 2016 office, so it is very simple to do
these are the steps
Go to INSERT and lok for "Tables", then the opcion called (excel)
An excel view is going to open, then in the sheets you can inser your information, make a table format also
In the excel view the go to Insert, Recommended graphics and select the one you want
here some photos
step 1
excel view
I'm very impressed by Trevor Eyre's version of the pop up calendar (answer # 11) and was excited to incorporate into a Userform that I am developing, which is challenging as I have VERY basic experience with VBA.
Formatting MM/DD/YYYY dates in textbox in VBA (Answer # 11)
Link to the example spreadsheet of Trevors https://www.dropbox.com/sh/0n9gyc32rlr31n2/AAAW7ADAWiLEZRHftERro9Tva?dl=0
For example, I have a userform named SECINC and have a text box (IncidentDate) where the user would have had to enter the date of the incident, until I came across Trevor's version of the pop up calendar. I am on Excel 2013 (64 bit) and the MS date picker is not available.
I have copied over all the code from the module1 into module1 of my project book and have saved and imported the CalendarForm and then I have my own userform, Refer to link:
Example of SECINC userform
I am happy to use just the basic CalendarForm as is, but the one thing I am missing is how do I call up the Calendar form when the user clicks the IncidentDate textbox and the selected date populates that IncidentDate box.
I have added an 'image' of a calendar and wondering how I link it to the CalendarForm so that when it is clicked it will open the Calendar and drop the date into the IncidentDate textbox.
I would need the date format in the IncidentDate textbox to display in DD/MM/YY format.
I was thinking that perhaps it would be advantage for us who are visually based, to see it in the form of a video tutorial and for those of use who are new to VBA.
If I have confused you, or you require further information, please advise.
Thanking you in advance,
TheShyButterfly
You need a click event on your image, that will call the calendar and fill in the date field
Right click on the calendar image and choose "view code" to create the click event sub.
Then add the command below as specified on Trevor's answer:
Private Sub Image1_Click()
your_date_field_name.Value = CalendarForm.GetDate
End Sub
Try to be a bit less "literal" next time you ask a question, we don't need that much details for such a simple question, it's confusing. I suggest you to read this
So I have programmed several userform with several user inputs(text boxes, check boxes, etc.) Now how can I use them outside of excel?
Currently I have to:
Open up the spreadsheet
Enable macros
Go to Developer Tab, View Code
Then find the right userform and run it or type F5.
Is there a more user-friendly way to run the userform? Its for testers who don't know vba or excel programming.
Thanks!
Yes, absolutely. You could create a button named after the form in question, and to that button assign the following macro:
Sub btn1()
frm1.Show
End sub
That's it! Of course, change the names according to what you have :)
I also reccomend having a button to close the form on the form itself.
OF COURSE this still uses Excel. If you want to use them on their own you could have something like this guy did: How to Open only UserForm of an excel macro from batch file
In excel 2011 on the mac, I have a spread sheet with two controls. A combobox and a button. the combo box is named Crops and i want to access the value of that box when clicking the button.
The obvious Crops.Value that would work in windows office does not seem to work and i get an error saying the Crops object is missing.
Is this (simple) task possible with VBA on the Mac?
ok solved it. Active X objects do not work on the mac. You have to use Forms elements and then if you want to access the value of a dropdown this is the VBA code. Hope it helps someone else.
assuming Crops was the combobox, Itm will have the value.
With ActiveSheet.DropDowns("Crops")
Itm = .list(.ListIndex)
End With
Could someone please explain to me the difference between the combo box that's available via the Developer Ribbon in Excel 2007 vs. the Combo Box control that's in the VBA editor? I cannot get this simple line of code to work using the Developer combo box:
MsgBox Combo1.Value
I've tied it to the change event and it seems to be syntactically correct (I'm not a VBA coder by any stretch).
Is the Developer Ribbon version some bastardized craptastic Microsoft shortcut?
What I'm trying to do is populate a second combo box based on the selection of the first combo box. I'd rather not build a case statement for every possible selection. Is this possible using the Developer ribbon version?
You are talking about the Insert button on the Developer tab correct? From that button you can add an ActiveX control or Form control. You're better off using the form controls if your new to programming as they will behave more in line with any Excel VBA reading you've done and the help file. With the Form controls you can right click and choose 'View Code' and/or 'Rename Control and Code'. Renaming the control allows you to address it in VBA however you like. e.g. - Combo1.value or myFavoriteCombo.value
That being said, to answer your question directly, be sure you know the controls full name. If you used a form control and it was the first one you put on the sheet it will be named ComboBox1. To get to the combobox's properties you have to walk through it's 'parent' sheet.
i.e.
MsgBox Sheet1.ComboBox1.value (using the sheet's code name)
or
MsgBox Worksheets("SheetName").ComboBox1.value (using the sheets name as it appears on the Excel tab)