I've made a non-modal 'Toolbox' form that floats over my worksheets. When a button is clicked a graphic item is copied from a hidden sheet and pasted into the current sheet. The graphic remains selected but the toolbox form takes the focus away from the sheet. When the user wants to move the graphic there is no problem in mouse-dragging but I'd like the user to be able to nudge the graphic using the keyboard arrow keys without having to click to give the sheet the focus. So, I guess the question is: How can I give focus to the worksheet following the Paste action?
I am aware that what I am hoping to do may well be impossible because it is possibly application-dependent.
Anyway, I wanted a piece of code that would allow me to open a default browser window from an Excel Macro.
Google turned up the following solution from here [URL] .....
[Code] .....
This seems to work just fine.
What I want to do now, however, is something like this:
[Code] ....
Is it even possible to write the two hypothetical functions described above?
In addition, I notice that they example given in the link that I posted also suggests ActiveWorkbook.FollowHyperlink. This seems to work just as well, without needing the ShellExecute prototype. Is there any way that I can get a "handle" for the window that was opened with FollowHyperlink and re-focus on that window?
I've got a worksheet with a cell called "cellName" and a button "cmdSearch". When I enter a string in cellName and press cmdSearch a query is done on a database and the result is returned to the form. Now, when I enter text into cellName I then have to click on a different cell before I can click on cmdSearch. What I'd like to do is have cmdSearch take focus if I press enter in cellName. I know how to do this with a UserForm, but I like having all of this on the worksheet and not dealling with a popup box.
I have a workbook developed in Excel 2007 (compatibility mode) that contains Userform4. This form can be displayed (or not) depending in the wishes of the user. What I am trying to do is return focus to the worksheet after the UserForm is displayed.
When the worksheet is activated, I have the following .........
I have a form that displays when i open a workbook. I enter data into the form's fields (listbox & textbox). When I click the form's "OK" button, the focus doesn't return to the current worksheet, and in fact, focus doesn't return to any of the open windows / applications I have open.
the formulas in sheet 2 of the attached file, the formula from rows 27 is returning nothing, and I think I’m not getting the formula right. It may need a little correction.
When the command button is clicked, the code runs, and leaves me on the "summary" sheet, but I would like the code to take me back to the original sheet where the command button is: "File Preparations".
I am attempting to place a formula in cell b3 in the attached spreadsheet on the "sheet to pull data into" tab 1 (cell is highlighted yellow) to retrieve value in the yellow highlighted cell in the "Sheet that contains data" which is on a seperate worksheet within the same workbook.
The cells highlighted red in the "sheet to pull into" tab (cells: a1, a3, b1, and b3) are the criteria that needs to be matched to those cells on "sheet that contains data" tab in order to ensure the value returned is correct.Sample of problem.xlsx <----see the attached sample spreadsheet.
I have the following code which copies specified cells from one sheet to the next available row on another sheet. I would like to keep the next available row somewhere near center focus on the display. Can I use the variable 1Row to do this, or maybe 1Row plus or minus 20 depending on how I want it displayed on the screen?
I am writing some VBA, and this is what is going on:
I display a form which asks the user to insert the desired number of invoices. After inserting the number, I would like a the cursor to appear in a textbox labeled "Invoice Date" (ref A28). Additionally, I would like the user to only have to key in the day and month. Therefore, I would like to have the cell be defaulted to / /2004.
I am using the following code to validate text entry in Textbox1 of a userform. I want that if the user enters a numeric value than a msgbox should popup and then cursor should get focus on Textbox1. But with this code, it is setting focus on textbox2 and not on textbox1.
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If IsNumeric(TextBox1.Text) Then MsgBox "Please enter TEXT value only.", vbInformation + vbOKOnly TextBox1.SetFocus End Sub
I have an application in excel in which a “combobox1” has been created on the main sheet of excel. Somewhere during the code execution the program requires input from the “combobox1”. What is the code required to highlight the “combobox1” allow the user to select from the box and then return control back to the regular code?
is there any way to know if a COMBObox has the focus?
* * *
I have a ComboBox and when I press ENTER inside this comboBox a run a Macro
Private Sub CbFormularios_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
some times I am inside the ComboBox and one of the Item whithin this combobos is Selected, but stead of pressing the enter keyboard I press a commadButton but to run the macro attached to this command button I have to know if the cursor of my mouse is whithin the ComboBox "Over the comboBox". kind of:
If ActiveSheet.Cbox1.Value Is Not highlited Then call Macro1
TotHCInv.Value = WorksheetFunction. Sum(KRInv, PBLInv, CRInv, PVInv) If i >= 34 Then CPSCtphRMA.Value = WorksheetFunction.Average("G" & (i - 30) & ":G" & i)
The first line runs properly, but the second line bugs out with the error message "Unable to get the Average property of the WorksheetFunction class". I can simply do the math, but I thought that using the worksheet function would be easier than summing and dividing. I'm curious, though, as to why I can't seem to use the Average function.
I have an active form that is always in focus. I would like to be able to seamlessly transition back to the worksheets under it, and move back and forth between the worksheet entry and form entry. Is there some way to alter the focus between events to do so (like a mouse over type event)? Currently, I can only exit the form to get back to the worksheet. excel 03 sp3
I am running software that calls an Excel macro using DDE. The macro populates a sheet with information to be printed, then prints the sheet.
I would like for this to take place in the background with Excel never taking focus from the software that calls the Excel macro. Currently Excel some times takes focus from the software and some times does not. The macro also takes the information it prints and stores it to another sheet, but I don't think that's the culprit stealing focus from the other software.
I have 3 workbooks in XLStart. I want to change the workbook that gets the focus after they are all open. The workbook i want to have focus is DG_Tourny.xls
I have a userform with several inputs which are validated, and should the input be invalid an ErrorProcedure is run. This basically displays a message telling the user what is wrong, and it should also be highlighting the text in the relevant field, but for some reason it is not doing that.
I had to reset my excel on friday now today I'm getting an error when opening up an workbook. The error is " Cant move focus to the control because it is invisible ,Not enabled or type that does not accept focus. I have this code in a workbook when the workbook opens
How to change focus back to Excel from other applications, how simply to report what application currently has keyboard focus - there is no need to change it?
I have a macro that launches another program (Windows Title - Storm). I then use sendkeys to have it export the file to an excel file. (This launches another instance of excel.) I want to be able to focus back to (Storm) so I can sendkeys to close the program down. I can get it to the end result using sendkeys, but I am trying to have it switch back to the Storm application so the user does not need to close it manually.
I have a userform with several fields located in it. For the most part, it looks like a user information form, Name, Date,, stuff like that. There is a field that the user enters some information, and using the afterUpdate function for the field, it searches to see if the value is unique. The problem is that when I tab from that field, if the value is not unique, I want the cursor placed back in that field (textbox). SetFocus doesn't seem to do what I want, unless I am using it incorrectly.
On the summary page click on 'Enter Sale' and notice that Customer Advisor' text box gets the focus and the cursor is flashing. (Which is what I want). Enter any name and a sale value (say 'A' and '1') and click the 'OK' button But when I tried to enter another sale the OK button still had the focus. So in the VBA Project / Forms / frm_sale / OK Click event - near the bottom I added a set focus before the 'frm_sale.hide' - This removed the focus from the 'OK' box - but the cursor is still not in the text box, and it needs to be clicked in order to enter text. This is clearly something trivial I am missing - but the blinkers are on and I cant spot it
I have SS that I have 3 levels of users using/viewing data and at the moment it does not allow for errors when inputing password & sheet number to access. What I need is that if there is an error in password or sheetnumber ths user gets the choice to re-enter correct data with vbYesNo or similar. The problem I have is with these lines of code not getting the focus back to txtSheet to re-enter correct data (>0 & <13).
Private Sub CommandButton1_Click() Dim shtNo As Integer Dim R 'Response to msgbox Dim rS As String Dim Msg, Style, Title, Help, Ctxt, Response, MyString Msg = "Please enter a number 1-12." ' Define message. Style = vbYesNo ' Define buttons. Title = "Choose Month" ' Define title. rS = Range("Scode").Value 'Staff password Application. ScreenUpdating = False If Not (txtSheet.Value > 0 And txtSheet.Value < 13) Then Response = MsgBox(Msg, Style, Title).....................
I am using MS Word to create a list to go into Excel, it seems advantageous to do it this way because I'm using the Heading Outline Numbering feature of Word.
Presently my macro assumes the word document is closed. How do I modify the macro to:
1. check if the file is open? 2. if already open, switch the focus to word? 3. switch the focus back to excel?
Sub GetDataFromWordDoc()
Dim FileToOpen As String
FileToOpen = ThisWorkbook.Path & "5Whys.doc" Sheets("Data1").Select ' MsgBox "Active sheet is " & ActiveSheet. Name ' My check ActiveSheet.Range("WordClear").Select ' Existing data to remove Selection.Clear
Set appWD = CreateObject("Word.Application")
' here I would like to check if the word file is open