In a VBA project, you can create a UserForm and add controls to it using the toolbox window. By default, the toolbox window contains the simple form controls such as Label, TextBox, ListBox, etc.
You can add additional controls if they're installed on your machine: right-clicking "additional controls" on the toolbox shows a whole screed of controls. However, this does not give any indication of where they came from.
I'm interested to know what controls are guaranteed to be available on a machine that has Office 2007 installed. Is it just the standard ones, or are some of the "additional controls" also guaranteed to be available (either because they come with Office 2007, or because they exist on all the versions of Windows that Office 2007 will run on)?
For example, I'm surprised that there's no treeview control even in Office 2007. In my "additional controls" list I see the "Microsoft TreeView Control v6", but I don't know whether I can rely on that being present for all my Office 2007 users.
The controls you see are part of FM20.DLL; which is part of the Office Install.
You can see that they are all part of the same DLL by looking in the "Location" portion of the "Additional Controls" box.
AFAIK, those are the only controls guaranteed available with most Office installations.
So that being said, let's see what can be done specifically for each control you ask about in your comments:
"grid" capable list
hierarchical tree view
calendar control
The Grid
It's going to come down to your requirements, but you may be able to get away with using a listbox. The listbox in VBA has a few of properties that make will make it Grid-like.
For example, let's say a worksheet in Excel looks like this:
ID001 Value 1 Description 1
ID002 Value 2 Description 2
ID003 Value 3 Description 3
The listbox supports multiple columns, so you can make these values show up by setting the listbox property ColumnCount to 3 and writing the following code:
Me.ListBox1.ColumnWidths = "50;100;200"
Me.ListBox1.RowSource = Sheet1.Range("A1:C3").Address
You will get something like this:
Want to hide a column? No problem, change the width of the ColumnWidths property to zero for the column to hide:
Me.ListBox1.ColumnWidths = "50;0;200" 'Hide column 2
What good is a grid if you can't select things from it, right?
On the listbox, change the ListStyle property to frmListStyleOption and then change MultiSelect to frmMultiSelect.
That will give you a listbox that looks more like a grid:
Calendar
08/17/2012 UPDATE:
Read this post. One of the guys who answered created his own calendar control.
A calendar control exists for Office (mscal.ocx):
However, the right conditions must be met:
Access must be installed on the clients machine
The Office version cannot be Office 2010 as it was removed with this version (See Features removed from Microsoft Access)
You can still get the calendar control to work with 2010 and/or non-Access Office installations, but it takes additional steps on the client's machine.
Download mscal.ocx
Extract it to windows/system32 directory
Register it
TreeView
If it's acceptable for you clients to install some EXEs, you could have them install Microsoft Visual Basic 6.0 Common Controls. That will give you the TreeView control.
I would be willing to bet that most machines (particularly older ones on Windows XP) already have these OCXs installed; thus the installation may not be necessary.
The biggest problem is that you're deploying OCXs on client machines and that gets frustrating from a support standpoint.
Related
I am currently working on an PowerPoint Addin and I am currently finishing the Ribbon. I'd like to create a control to change the size of objects that looks similar to the inbuild button "ShapeWidth" and "ShapeHeight":
However, I couldn't find the correct control type and hence I built the below by myself using an editbox and buttons. Although it's working I find the other style way cleaner but I haven't found the correct type.
Not all Ribbon X (Office Fluent UI) control types that Microsoft uses in its Office applications are made available to third-party developers. This, I'm afraid, falls into that category.
You should probably be able to get the image, at least, by specifying the idMso for the built-in control.
A Microsoft Word 2013 document at work has the Document Information Panel (DIP) displayed by default, with what is listed as "Document Properties - Server".
I'm trying to make a VB Macro that will involve editing these custom properties. However they don't seem to exist in ActiveDocument.CustomDocumentProperties, or ActiveDocument.BuiltInDocumentProperties. I know this because I ran through the list, displaying them one by one, as well as searching them by name.
The first property on the DIP called 'Title' showed up (in the latter list), but none of the other properties. It's worth noting that some are dropdowns, and one is a date with a calendar feature. I should also mention that I get a Run-time error near the end of the list of BuiltInDocumentProperties.
Is there another list where I can access these server properties, or some other issue that I'm overlooking? Any help would be appreciated.
I was able to find them. They are listed in ActiveDocument.ContentTypeProperties
My issue involves PowerPoint Add-Ins all being named VBAProject.
Microsoft Office Pro Plus 2010 - PowerPoint 2010 32 bit
Running Windows 7 Pro SP1 64 bit
I have several add-ins for PowerPoint saved as .PPAM files. In any PowerPoint file I can (or should be able to) link add-ins to extend that presentation's functionality. Each .PPAM file is named differently. In the VBA IDE however, in the list of references, each add-in is called 'VBAProject'. There are multiple entries of 'VBAProject' each one showing a path to a different .PPAM file. The problem is that I cannot add a reference to more than one add-in because the same name assigned to each of these; VBAProject. This results in a name conflict. Using the add-in manager from PowerPoint design view I can see all the selected add-ins as being 'active'. The Add-in manager for the VBA IDE shows no Add-ins.
Questions:
Is the naming of PowerPoint Add-ins as 'VBAProject' expected for every add-in?
Is there a way of change the name 'VBAProject' to something unique and hence avoid the name conflicts?
So it seems as if I have found the solution to my problem and would like to share it with the community. It involved a small change to the registry. [Be careful when dealing w/ the registry and make a back-up prior to any changes.]
From Regedit.exe -> HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\PowerPoint\Options. Change value of DebugAddins from 0x00000000 (0) to 0x00000001 (1).
With this done you will be able to see all the add-ins in the VBA IDE and from there you can change the name 'VBAProject' to something unique.
I'm making a custom control in VB.net 2008 Express. Without getting into the details, I am able to duplicate the issue as follows:
Make a blank custom control. Stick two textboxes on it. Don't add any code.
Run it and click the second textbox. (Don't click the first.) The text cursor appears of course.
Now Type... Although the text cursor moves within the second textbox, the text you type appears in the first textbox, not the second one.
I have found that this issue depends on the tab order of the controls. Whichever textbox is first in the tab order gets text typed in the other.
I have also found that if you press [Tab] to set focus on either textbox, the problem goes away.
QUESTIONS:
1) Is this a known bug in .net? (Specifically 2008 Express)
2) Will this phenomenon carry over when the custom control is brought into a larger project?
I followed the steps above and was able to reproduce it when I started with a Windows Form Control Library and ran it inside the UserControl TestContainer. I test this in Visual Studio 2008 Professional.
However, when I placed the user control inside a form in a separate Windows Forms Application project, the issue did not occur. So I'd think it's safe to say that this won't be an issue when the user control is used in another project.
In access the multi combo box that I have requires me to click okay to add the selections to the box. Is there VB code to make it to where when you check beside the selections it automatically adds them to the box when you leave it?
If you are using SharePoint with this database, add the SharePoint tag to this post.
If you are NOT using SharePoint, my research indicates you should not use a multi-valued combo box.
Reference 1
Reference 2
Reference 3
Reference 4
It's one of the those features provided by Access that tries to offer a shortcut while undercutting good database design. The original classic is the Lookup Field.
If you still want to use this feature, VBA might let you smooth the user experience using
DoCmd.SetWarnings.False and (later) DoCmd.SetWarnings.True.