Excel 2007 :: Insert And Link ActiveX Control From VBA
Mar 15, 2012
I have a form that collects four pieces of information from the user and places each into columns A, B, C, D on a sheet. I would like to automatically add an option button to column E so that a user could select it and then click a control button to delete the corresponding row.
Is this possible or is there maybe a better way to do this in Excel 2007.
I have an excel application which works extremely well in one single instancec. It has a bunch of ActiveX control objects on the worksheet. Generally I call them by convention Sheet1.Cmd.show.
I have since experimented with having multiple instances of excel running on the machine. I start to notice something very strange. The first instance I open and run all the activeX buttons are all clickable. As soon as I open a second instance of an excel program all the activeX buttons on the worksheet are not even clickable. They are enabled by my program, but not clickable as if they were not there at all.
I also try open a normal excel workbook then followed by my excel program in a second instance. Even though the first excel file does not utilize any activeX objects all my buttons on the subsequent instance are not clickable.
The weird thing is all my activeX control objects on a userforms are still clickable and call to all my planned events in my program. It is just all the activeX controls on my worksheet that do not have any reaction at all.
I always think when one opens a new instance it will be totally indpendent and would even occupy another CPU if my machine has more in it. If they are truly independent then I am at a loss to understand why my activeX controls would fail to work at all.
ActiveX control? (=EMBED("Forms.ComboBox.1","") They are filled using named ranges on another worksheet and work fine. The problem happens when I share the workbook the combo boxes become completely non-functional. They don't even drop down when clicked.
I'm building a spreadsheet which includes a few columns which have activex check boxes which are linked to cells. I want to allow the users of the spreadsheet to insert new rows if necessary. Ideally, when these new rows are inserted, the check boxes would also automatically appear in the corresponding columns of the new row (and be linked to the relevant cells), just the same way that pull-down menus and formulas automatically copy into the new row. Is there a way to do this?
I have some VBA code that in one portion of it an Outlook e-mail is created and the active workbook is attached and sent. This code used to work on Excel & Outlook 2003, but now in Excel & Outlook 2007 I'm getting the error:
I'm using a macro to insert a photo in to a Excel 2010 workbook. If the photo moves location it will no longer display the photo in the document as I belive the photo is being referenced instead of embedded.
If you then use the "Change Picture" icon the photo embeds but how do I get my macro to embed the photo.
Dim SH As Worksheet Dim Rng As Range Dim MyPic As Picture Dim sPath As String Dim PicH As Single
I am trying to create a workbook where the first worksheet has a list of Checkboxes and each checkbox 'unhides' or 'hides' subsequent worksheets within the workbook, depending on whether the box is checked. I can make the checkbox, I can record the macro.
Sub Test_checkbox() ' Test_checkbox Macro Sheets("Dist").Visible = True End Sub
How do I link them together? Ideally, I'd like to have my boss be able to 'play' with which sheets are visible (check, uncheck, check, uncheck, etc) .
My set up office 2007 win xp pro ie 8 I am using the code below to retrieve web pages etc it works fine, however it display in differ areas of the screen, so I was wondering if there is a way to control the positioning and the size of the window?
Code: Set EXP = CreateObject("InternetExplorer.application") EXP.Visible = True EXP.Navigate (aurl)
I have a worksheet with several data validation dropdowns that each link to a series of hyperlinks. When you click the dropdown and select the hyperlink, it opens up that particular file. All of these work, except for one of the dropdowns. Even though I can see and select the names, the link is NOT activated.
Is there some obscure excel feature that I am not aware of that is preventing this one from working? Why would this be?
I copied a routine from this forum that would email a single sheet from a 10-sheet workbook to a recipient. This worked great for a long time, then all of a sudden I started getting the "ActiveX control can't create object" error. Here is my
I have an ActiveX Label control with a transparent background. When I click on the label the background turns white and stays that way as long as the mouse is over the label, obscuring whatever's underneath. (It also very slightly alters the character spacing.) What object/property controls this? How do I adjust it?
While I'm here, is there an easy programmatic way to assign arbitrary RGB colors to ActiveX controls? The palettes available from the Properties window are fairly limited. A google search for "ActiveX colors" yields a deluge of marketed products, so it's hard to find useful information.
My drop downs are simple yes/no/NA witht a down arrow apprearing to the right. Works fine for all users except one troublemaker who for some reason sees the text and arrow as a mirrored, upside down image. It's not rotated to be upside down, it's mirrored so if you turned your monitor upside down you'd see the letters in the words backwards as if looking in a mirror. We're both on Excel 2007.
Scenario: I have a worksheet full of ~360 tasks. Tasks are broken down into phases, have owners, and have status'. I leverage a pivot table to easily sort my data by owner, or by status. When reviewing the pivot table with others we want to update the raw data. This entails changing worksheets and scrolling to the task in question.
I'm looking for an easier way to update the raw / original data.
Options I've tried to pursue but have come up empty: Option 1: Excel modification? Is there a setting in Excel 2007 that would allow me to change a value in my pivot table and have it propagate to the original data set (another Excel worksheet)? So far the answer seems to be "no". Is this possible?
Option 2: Hyperlink from Pivot Table to Raw data field. - I cannot create hyperlinks within PivotTable data cells. - I have used the "hyperlink()" function OUTSIDE of my pivot table, along w/ a "match()" on a key field in my pivot table to create hyperlinks back to my raw data... But this is prone to breaking. - Is there a way to enable hyperlinks from within a Pivot Table? I have seen other requests from individuals that had a pivot table with actual hyperlinks (e.g. [URL]...) and they could not 'activate' them.
Option 3: Tool Tip VBA Form w/ Link?
- If I can't create hyperlinks directly in the table, then how about a function so then when i click (mouse over?) a pivot table cell a form appears with a hyperlink back to the source data?
Option 2 and 3 Assume that there's an way to get at the underlying location of the raw data (e.g. "Pivot Table Worksheet!E10" comes from "RawData!C4". I've dug through some VBA documentation at Microsoft.com but came up empty. I know this link must exist behind the scenes - In Excel 2007 when you mouse-over a pivot table cell Excel displays: "Row - Phase - Owner - Status", which is directly out of the raw data table/worksheet. [[This was an incorrect assumption... When i looked at the pivot table tool-tip closer I realize it was just walking through my data :'( row.
What is the VBA Code to revel the source cell? If i can get at that data, (and hyperlinking can be turned on w/in the pivot table...) then I can easily write a script to walk through the pivot table and create links back to the raw data... Not a perfect solution - but it takes away the need to search through the source data for the row I want.
Since Form Controls comboboxes don't allow font editing, I need to switch to ActiveX...
The combo box values come from the following cell range:
Those values are, from top to bottom: "select distance", "50 Miles", "100 Miles", "150 Miles".
The following macro is also assigned to the combobox:
I have two issues. The first is that the macro doesn't seem to be working. It is supposed to filter a list of cities within 50, 100 and 150 miles of a user input zip or city. The original Forms Control combo works but not ActiveX after I put the code in the change event:
The second issue is that the last clicked value in the ActiveX comboBox replaces the top one.
Ex: from top to bottom, the combobox should display:
but if the user clicks "100 Miles", the combobox is then going to display
If the user then select "50 Miles", the box displays:
I have created several macros where i use an active-X control button. This button is pressed and the macro begins...........but every now and again this button changes size for no apparent reason.
I have read countless articles/posts about what "may" be causing the problem but i have never read anything which clearly identifies the soln to this problem and the problem has been out there for years. To make matters worse the problem can not be duplicated on any regular frequency that i am aware of............so its not like i can post a file that will show the problem.............
I am using the following code to copy a template to a new worksheet each month:
Code: Sub CopyTemplateNewMonth() Application.ScreenUpdating = False Dim SourceRange As Range, DestRange As Range
Everything copies over except an Activex Control button. I also have form control buttons with macros assigned to them, and they copy & paste just fine. The code assigned to the ActiveX button also copy's & paste's just fine...but the button itself does not.
RE: Macro ActiveX Click Control--It stops when on another sheet
Macro runs OK when run from menu.
An activeX click button was put on sheet B.
Right click the control, View Code, Paste in code from macro, then click button.
It runs the part of the macro that applies to sheet B, goes to previous sheet A, and then stops. The range select line for the named range on sheet A is highlighted in yellow. It stops when selecting any range or cell on sheet A, like B2.
Any idea why this code does not work on sheet A when ActiveX button is on sheet B? Is there someplace else that the control can go? Using Excel 2000.
See part of code below, which starts on sheet B:
' Macro recorded 11/22/2007
Range("SortAll").Select Selection.Sort Key1:=Range("T2"), Order1:=xlAscending, Header:=xlNo, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom ActiveSheet.Previous.Select Range("FormBase").Select (STOPS HERE) Selection.Copy Range("Formul").Select ActiveSheet.Paste ActiveSheet.Next.Select FormBase is a named dynamic range FormBase=OFFSET(A!$A$2,0,0,1,MATCH(1E+306,A!$2:$2))
"How to create a 'main' macro to control other macros within a workbook". I have my individual macros created. There's one macro for each sheet that searches online data and returns the information. I have one of these per sheet (a total of 20 sheets) since I couldn't find a way to have all 20 macros be on one sheet and still work. My trouble is that whenever I'm on my 'main' sheet and try to run the macro which applies to a 'secondary' sheet, I get an error. I have to select the sheet first, then run the macro and it works. Below is the macro on each sheet.
VB: Sub Holding1() Dim DataSheet As Worksheet Dim EndDate As Date [code].....
I have a userform with a textbox and would like the user to type inside the textbox which in turn send the text typed to a cell on my spread sheet say sheet 1 cell ref A1. I am writing the following into the control source Sheet1!A1 but the control source does not except this. I am using excel 2007 .
After programmatically creating a new activex checkbox, I want to create a sub for it's click event. I have given the object a name, and fortunately the code for it's click event is a one-line call of another sub, but how?
The sub would look like the following except be named after the new control (obviously), and yes, it is just the number in the name that changes:
Can Active-X control button macro be placed in a regular module, or does it always have to reside in the sheet module? Or is the only way to accomplish this is to have the macro in the regular module being called from the button macro in the sheet module?
I somehow seem to remember a way to move/assign an Active-X ControlButton macro to a regular module, but maybe I'm wrong?
I have a worksheet that contains a number of ActiveX image controls, which have been scaled to a uniform height to serve as thumbnails.
I have also created a class, where each instance is initialized with one of these image controls, and events (specifically the on click event) are captured. When the user clicks the picture, it opens a userform containg the same picture. However, I'd like that picture to be at its original size, not the scaled-down size.
how can I determine the original dimensions of a picture used in an image control? I can tell that the original resolution is there (by changing the PictureSizeMode to clip), but I can't find any properties that show me how big that image actually is, only ones that return or set the size of the object itself.
I've several check boxes on a worksheet. Some of the check boxes control the values of other through the _click event. However, when I try to change the value the event attached to the control in questions fires.
application.enableevents = False
would prevent events being fire from within the macro but this only seems to work when I step through the code.
I understand that I could set a global variable to do this and will probably go down this route anyway - but I am interested to know how/when I should be using the EnableEvent method (as I am sure this should be the way that I use it)
MFI is the named ranged that is referencing a column of data. This works, but I want to be able to change the MFI to a different named ranged.
So what I am trying to do is using an ActiveX Combo box so I can reference the named ranges that I have set, for example MFI, so each time a user chooses MFI or another named range, it will output to a linked cell (A1). Then the linked cell will be referenced into this forumla.
In A1 there is an ActiveX Control Text Box inserted, now in A1 cell which is beneath this text box contain the formula that if A9 is blank than "Customer Name" should appear else it should show blank. But the problem is when I write some thing in this text box which is connected with A9, formula works as "Customer Name" disappears but when I delete in text box it simply acts as if something is still present in cell A9 and formula does not comeback to "Customer Name" again & therefore in order to appear "Customer Name" I have to go to A9 and press delete button to get the desirous result from the formula.
Readers are requested to make this formula work becz the situation in which this formula has been invented is well fitted and not other formula can supplant it.