Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Excel Opens And Locks Up When Placing Mouse On Scroll Bar??

I am in no way a VB expert and I am having a issue when opening a existing spread sheet from a third party software. When I open it from the third party software it is using VBA to call Excel, open it, and then open the spread sheet. If I open the spread sheet just using Excel then it is fine but opening it through this software I get an error everytime I touch the scroll bar. Below is the code that calls out the spread sheet. Any help would be greatly appreciated.
Private Sub cmdRecipeEditor_Click

' RECIPE EDITOR - Allow 'RecipeEditor' command only when the operator has the appropriate
' security rights and only from the assigned terminal.

Dim Recipe
Dim appXL As Excel.Application 'Set reference to the Excel Library
Dim is_area As Variant
Dim FullPath As String
Dim myPos As Variant

is_area = InStr("Y3411", User.Area.CurrentValue)
If is_area <> 0 Then

checksecurity "Y3411_PROC_OP"

If bsecurityclearance = True Then
If FindExcel Then
'Excel is running, bring it back to the front
'Get security setting for the excel file
checksecurity "Y3411_RECIPE_EDITING"
'Open Excel application.
Recipe = Shell("D:Program FilesMicrosoftOfficeOfficeExcel.exe", vbNormalFocus)
'Run Excel Application
AppActivate Recipe

' Determine the full path for the excel file.
myPos = InStr(User.PathY3411.CurrentValue, "Pic")
FullPath = Left(User.PathY3411.CurrentValue, myPos - 1)
FullPath = FullPath & "AppRecipeEditor.xls"

'Open Recipe Editor excel file.
Set ExcelWorkbook = GetObject(FullPath)
ExcelWorkbook.Application.Visible = True
ExcelWorkbook.Parent.Windows(1).Visible = True
'Enter the security level and name for the current user
ExcelWorkbook.Worksheets("Security").Cells(4, 1).Value = bsecurityclearance
ExcelWorkbook.Worksheets("Security").Cells(2, 1).Value = UCase(User.CurrentUser.CurrentValue)
End If
MsgBox "Unauthorized Entry Attempted" & vbCr & "Access Denied"
End If
MsgBox "Operation not valid in this area"
End If
'Release object from memory
Set Recipe = Nothing
Set appXL = Nothing

End Sub
Thanks again to anyone who has an idea!!


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Simple: Can I Use Mouse Scroll In ComboBox (in VBA Excel)?
I would love to be able to use mouse scroll to change values in my ComboBox when its 'activated'. Is there a way to do this? I know it works in my VB6 applications, but it doesn't seem to work here.
A look at my code if needed:

Option Explicit
' This userform is called to pick a job number and write
' its properties to the cover sheet and spine sheet

Private Sub UserForm_Initialize()
Dim i, j, x As Integer
Dim currentjob As String
Dim lRealLastRow As Long
Dim lRealLastColumn As Long

customer = ""
job_desc = ""
client_num = ""
x = 3

Sheets("Job Numbers").Select

On Error Resume Next
lRealLastRow = Cells.Find("*", Range("A1"), xlFormulas, , xlByRows, _

For i = 3 To lRealLastRow
ComboBox1.AddItem Range("A" & i).Value
Next i

ComboBox1.ListIndex = lRealLastRow - 3

End Sub

Private Sub ComboBox1_Change()
Dim strJob As String
Dim ChosenRow As Long

strJob = ComboBox1.Value
ChosenRow = Cells.Find(strJob, Range("A1"), xlFormulas, , xlByRows, _

customer = Range("C" & ChosenRow).Value
job_desc = Range("E" & ChosenRow).Value
client_num = Range("D" & ChosenRow).Value

ListBox1.AddItem customer
ListBox1.AddItem job_desc
ListBox1.AddItem client_num

End Sub

Private Sub command_ok_Click()

MsgBox job_num & vbNewLine & customer & vbNewLine & _
job_desc & vbNewLine & client_num & vbNewLine & _
start_date & vbNewLine & quoted_hrs

Sheets("Cover Sheet").Select
Range("E23").Value = customer
Range("E25").Value = job_desc
Range("E26").Value = ""
Range("E27").Value = client_num
Range("E30").Value = ComboBox1.Value

Unload Me

End Sub

Private Sub command_cancel_Click()
Unload Me
End Sub

How Can I Dynamically Scroll The Scroll Bar, Not By Mouse Click Manually For MSFLEXGRID?
How can I dynamically scroll the scroll bar, not by mouse click manually for MSFLEXGRID?

thank you!

Best Regards,

Kevin Shen

Access Link To Excel Locks Excel File
We have an Access database that has a link to an Excel file. We created a snapshot query in the same database that we use to open the link in read-only. We have another snapshot query that queries our Excel link snapshot query plus 3 other Tables. One of the tables is linked to the Excel snapshot query by a field. If we only open the Excel snapshot query, the Excel file does not lock up and other users can access it through Excel. If we use the other query however, the Excel file locks and other users cannot even open the Excel file through Excel. Does anyone know a way around this that we can keep the link without locking up the Excel file?

Scroll With Mouse Scroll Button In ListBox
Edit by Moderator:


(I hope I'm not contravening some code of conduct here...), but I have gone through your solution rendition as per above just using the pieces I need. The solution is great and works from a form perspective.

However, my situation is that I have 2 listboxes embedded in the excel worksheet itself and I think the fact that it fails to work is due to this. For example a worksheet does not have an ActiveControl attribute. Also, I placed your "Hook" code into the GotFocus event for the listbox and the "UnHook" code in the LostFocus event.

If you could shed some light I would really appreciate. Many thanks in advance.

Again sorry if I'm not following protocol here - (am very new on the site).

Scroll With Mouse Scroll Button In ListBox
Edit by 00100b:
Split from this thread.
Please refrain from hijacking/gravedigging threads. For further details, see this site's Posting Guidelines.

Sorry to bump such an old topic, but I've just now run into this situation, and would like to use the mouse wheel to scroll through a listbox that's populated with over 200 lines (It's actually a form that acts as a text editor, so that people other than myself are able to easily edit the text that's strewn across multiple sheets, some of them hidden, without screwing everything up). I tried the code posted above, but I obviously had an unhandled error somewhere along the way, because as soon as I attempted to open the form that contains the listbox, Excel disappeared.

Is there some reference I need to add in, or something else I need to do in order to get this to work? I am using Excel 2000, so I don't know if that means my version won't work with this code, or if there's a simple fix.

If anyone has any suggestions, I'd love to hear them.


Scroll With Mouse Scroll Button In ListBox
Hi folks,

I am looking for a way to make my Listboxes in VBA Excel Forms respond to scrolling with the mouse button.

Is it possible? How? Need help... didn't find anything yet!

Mouse Scroll Wheel Vs Vertical Scroll Bar
Right then i have a small problem.

I have a VScrollBar which scrols the contents of a custom picture box, how do i make the scroll bar scroll when the mouse wheel is moved?

Cheers people

Excel Locks While A Cell Is Active
[Using: VB6]


I want the user to enter in some data. To do this, my program opens Excel, then the user enters lots of data in. When the user clicks a 'Finished' button on my form, the program reads in from Excel what the user has typed in, validates it, and bungs it all into my database.

This is working pretty well. I've now come to the testing stage, and I've realised that if the user clicks 'Finished' while an Excel cell is active (ie the user is editing the contents of the cell), then my program cannot access Excel because Excel is busy waiting for the user to finish editing the cell. How might I trap this error?

Any suggestions would be appreciated,


Scroll Mouse Doesn't Scroll
Does anyone know how to get the scroll mouse to work in design time of VB6.0?

Macro Opens Excel
This is an Excel problem, but I think it's caused by Access, so I'll post it here. I've got a VB app that gives me updated data on our call center every 15 minutes. The data is exported to Excel spreadsheets, then a macro in Access imports the data from Excel into Acess to be read into my VB app. Every once in awhile I'll get the message that a spreadsheet is now available for read-write, and the spreadsheet becomes visible. I can close it, but if I run the taskmanager and check the processes, Excel is still running, which is where I think the problem lies to begin with. Am I missing something in my code that is not "closing" Excel properly? I'm not opening Excel directly in the app itself, only through the macro. Any ideas?

Excel Opens Very Slowly: My VB6 DLL
I have written quite a few functions including forms and such in VB6 and created a DLL file. I then have an Excel file reference and call that DLL file for a variaety of functions. This program has been built from just a couple of functions to a DLL of approx. 1300kb.

Just reciently, the Excel file takes at least a minute to open. There are no "Upon workbook open" type functions going on at all, just a reference to the DLL in file's VBA. All fuctions are run via VBA buttons calling class modules in the DLL file and none of them run upon the opening of the Excel file.

Could this be because of the size of the DLL file? Any ideas?

Using Access Opens Excel File
Hi all,

I'm using MS Access to open 1 Excel file, but I meet one issue.

That is if I check that the file is opened, I don't know how to close it.

Set appEX = New Excel.Application

If appEX.Workbooks.CanCheckOut(sPath) = True Then
MsgBox "Hi, can check out!"
'Please tell me how to close it and reopen it by Access.
End If

Thank you very much.

New hire.

Excel Opens Multiple Times
I open a spreadsheet I want to work with when my program loads using the code below. Each time i execute my code to perform some calculations on the spreadsheet a new instance of Excel is opened. How do i stop a new instance of Excel opening when I execute my code?


Private Sub Form_Load()
oXLApp.Workbooks.Open FileName:=App.Path & "" & "OSPREY.xls", Notify:=True
oXLApp.Sheets("LBOP-New Capital p.a").Select
End Sub

Excel Opens, Form Shows
hi everyone!
i was wondering if you know some trick so as to make Excel show a form every time it's opened, no matter the file the user wants.
(so i guess "workbook_open" doesn't deserve to be considered)
thanks! >>> damkauf

Loading VB Form When Excel Opens.
Hi good people. I was wondering how to "pop up" a VB (editor) Form when a Spreadsheet is opened. This is for auto population purposes. I know how to create the Form and auto-populate the cells, but I can't get the Form to automatically run when the Spreadsheet is opened. Any suggestions?

Thank you, DAVE

Auto Running A Macro When Excel Opens
I would like to have a macro run in an Excel spreadsheet when the spreadsheet is opened.

Does anyone know how to get a macro to run on the spreadsheet open event?

Placing Array Into Excel
Hi there.....
I was to program a software which needs to interface with a spectrum analyser. But after retrieving the data from the device, I have a
place a varying array into Excel. To start with I need to create a "worksheet" but there seems to be some problem. Can any one please help me.


Messagebox Before The Excel Workbook Opens: Updating References Or Not?
Hello, this is the background: I have a workbook ABC and I copy a sheet B from that to another workbook DEF.
ABC contains a cell like this =Res!C13. The cell in the copy now looks like ='[ABC.xls]Res'!C13. So there is a link to workbook ABC. That's OK but I do not want any links. I just want the formula =Res!C13 because there is a sheet named Res in DEF. Now I delete all the references to ABC and yet when I start the workbook again I get the question if I would like to update the references or not. I have tried both and I can see no difference in the cells. They are what I changed them to.

I do not want the question when opening DEF because a future user shall not have that "strange" question. Are there any hidden links from DEF to ABC? What can I do to get the workbook open like a workbook that has never had any links?

Most grateful for help!

Edited by - benes on 12/22/2006 4:18:05 AM

Placing A Text File In MS Excel

I have a programme that creates a notepad document, log.txt. I want this document to be opened in Excel and don't want to see log.txt. I'm not sure why it has to go to Excel but Big Boss says that's where it has to go!

Thanks in advance

Placing A Combobox On A Spreadsheet (excel)
I'm working with Excel 2002. I want to add a ComboBox directly on the excel spreadsheet. Is that possible? If so, how do I do that?

I want the user to be able to specify the data type to be used throughout the workbook. ie. percent, number, etc.

Thanks in advance!

Placing Controls On Excel Worksheets
Hi everyone.

I have started venturing into the world of Excel Macro Programming. I like to know how can i place a control like a combo box on the worksheet on a particular cell so that when the control focus on the cell the user can press the drop down combo and select the option from the list and then proceed.

I know how to place controls on User form and manupulate them but i want the contol on the worksheet itself. Is it possible ?

I small piece of code will be appreciated.

Thanks to all


Auto Execute Excel Macro When User Opens Workbook
I want to execute a formatting macro automatically when a user opens a workbook (assuming they click "Enable Macros"). Is this possible? and if so, how?


Placing Excel Data Into Access Table
The code will create a Table and four Fields in Access, but does not populate with data. Here's the error message I get.

"-2147217887: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data." Is this an issue with the code or with Access, because I don't have an option to paste less? Also, where would I find this error reference number defined?

Your thoughts please.


Sub AccessTbl_From_ExcelData()
Dim conn As ADODB.Connection
Dim cat As ADOX.Catalog
Dim myTbl As ADOX.Table
Dim rstAccess As ADODB.Recordset
Dim rowCount As Integer
Dim i As Integer

On Error GoTo ErrorHandler

' connect to Access using ADO
Set conn = New ADODB.Connection
conn.Open "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = C:Database_Examples" & _

' create an empty Access table
Set cat = New Catalog
cat.ActiveConnection = conn
Set myTbl = New ADOX.Table
myTbl.Name = "TableFromExcel"
cat.Tables.Append myTbl

' add fields (columns) to the table
With myTbl.Columns
.Append "Date", adVarWChar, 4
.Append "Amount", adVarWChar, 6
.Append "ChkNumber", adVarWChar, 9
.Append "Description", adVarWChar, 11
End With
Set cat = Nothing

MsgBox "The table structure was created."

' open a recordset based on the newly created
' Access table

Set rstAccess = New ADODB.Recordset
With rstAccess
.ActiveConnection = conn
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open myTbl.Name
End With

' now transfer data from Excel spreadsheet range

With Worksheets("Checking1")
rowCount = Range("A2:D210").Rows.Count

For i = 2 To rowCount + 1
With rstAccess
.AddNew ' add a new record to an Access table
.Fields("Date") = Cells(i, 1).Text
.Fields("Amount") = Cells(i, 2).Value
.Fields("ChkNumber") = Cells(i, 3).Value
.Fields("Description") = Cells(i, 4).Value
.Update ' update the table record
End With
Next i
End With

MsgBox "Data from an Excel spreadsheet was loaded into the table."

Finding Data && Placing In Different Cell W/Excel && VBA
hey all, I have an excel spreadsheet that i am looking in for some product data. the name of the product is in the first column (A). I am looking to the right 1 to 3 cells for some data that relates to the product name. This is what i have so far:

Private Sub CommandButton1_Click()
Dim maxrows As Integer
Dim rowIndex As Integer

'get the max number of rows
maxrows = InputBox("Please enter the number of rows", "Number of Rows")
'search the first column for the value
For rowIndex = 1 To maxrows
If Cells(rowIndex, 1).Value = "DS1" Then

ActiveCell.Offset(0, 1).Select

End If

End Sub

what it does is get input from the user for the number of rows, then searches the first column for the product name. if it find it, I want it to select the cell one column to the right and pull data from that cell and put it into another different cell (say, cell (20,40)).
The code finds the cell in column one without the statements after the "then". I'm not sure what i should do to select the cell directly to the right of the cell that contains the product name that i am looking for. Can anyone help??


Placing Data From Form Into OLE Excel Worksheet
I want to be able to place data from a textbox or list box into an excel worksheet. I have opened an OLE control and assigned my excel worksheet to it.
My question is how do I move my data from the form into specific cells on the worksheet.
I am using vb5 in win98.
any help would be appreciated.

Placing A Graph/Chart In Particular Location In Excel (A42:D55)
 guys one more question.
  I have created a grap[h using marco, but i want it at particular location.

Like i want the graph to be place in the range(A4255)

If you guys come across this, please help me.


Placing Button Into The Cell When Mouse Enter Into Particular Cell
I 'm using DataGridView in my Project

How do I place the button dynamically into a particular cell of the DataGridView when the mouse enter into the cell, n making the button visible false when the mouse leaves that cell.

Retrieving Data From An Excel Sheet And Placing It In A Userform
Can anyone help? VBA Newbie

I have created a userform which automatically updates a spreadsheet with the information entered into it. The form uses combo boxes, text boxes and check boxes.
However i need to able add some sort of search function that allows me to pull the information back up into the userform to i can amend it if necessary and then update without putting it on to a seperate line in excel. Is this possible. Any code would be appreciated.

Placing Forms Textbox Inputs Into Excel Database.
I am trying to have the inputs from a form, populate a database on a seperate sheet of the same workbook.  I need the database to start at a specific cell.  I have a heading on the top and the first two columns have formulas.  I have been playing around with my code and it seems that the formulas are setting the start point for form inputs.  example, column A has formulas down to row 10, then the inputs will start at C11.  Note, in the process of working on this issue I screwed something up and it no longer indexes for the next entry.

Here is what I have so far, I was hoping someone could help me over this hurdle.

Private Sub cmdsubmit_Click()

' goto database
    Dim input1 As String
    Dim RowNum As Long

    input1 = txt_input1.Text
' Put the data in the current worksheet:
    If Cells(3, 3).Value = "" Then
       RowNum = 1
       RowNum = ActiveSheet.UsedRange.Rows.Count + 1
    End If
    Cells(RowNum, 3).Value = input1
'go home
    Unload form1
End Sub

thanks in advance for the help...

Create Custom Combo Box And Placing It In One Of The Cell In Excel
I just learned VBA and having some problems right now.
I wanted to create a custom combo box (using VBA) that's stored some info and is fixed in a cell in the Excel. Is it possible? And if yes, can someone show me how to code it.

Mouse Scroll In VB6

could anyone please tell me if you can use your mouse scroll in vb6 IDE? 'cause I can't, and that's very anoying when workin with big sources.
I'm using VB6 EE SP6

Mouse Scroll
Anyone know how to get the scroll wheel to work in the VB6 IDE? It scrolls fine in other apps but not in the code window of VB6 during development. I'm running under WIN2K. An identical mouse on another system using WIN98SE scrolls the VB6 code window just fine. Is there some setting in VB6 or WIN2K that would disable the wheel in VB6 only?

Mouse Scroll
Does anybody know how to access the mouse scroll ball? I have no idea how to incorporate this into my program but I would like for each "click of" of the mouse ball to be the equivalant of pushing one of my command buttons once.

Thanks in advance

Mouse Scroll
in vb6 IDE or design time, why mouse is not working?
how to enable mouse scroll?

VB6 IDE - Mouse Scroll?
In the editor window of the VB6 IDE (Visual Studio 6.0), I can't use the mouse wheel to scroll through my code. It will work in the Project window though. I have tried it with the window minimized and maximized. Has anyone found a workaround. It also happens on a co-worker's IDE so I doubt it is a PC specific thing.

p.s. It does work for FoxPro and C++

Mouse Won't Scroll In VB6
My mouse won't let me scroll through pages of my code in VB6. It works with other apps like MS Word or Explorer

In Vb How To Get Mouse To Scroll
why cant i inside a vb code window, scroll down with the middle mouse scroll thingy magigy

How To Use Mouse Scroll In My App? - Can It Be Done?
how can i detect mouse scroll in my app?

TIP - Scroll Mouse In VB
Quite often you will find that your scroll mouse wont work in the VB6 IDE.
Here is a quick tip to enable it as I don't think everyone knows how to do it.

I have the MS Intellipoint driver and it lets you set program specific functions
for the various buttons on your mouse.
If you open the mouse settings from Control Panel then click "Settings"
you can add VB6 here.

However, it doesnt seem to give a permanent fix.
To get around this, I now have a shortcut on my quicklaunch bar to open
the mouse settings. When I open VB6 I open the mouse settings then
click OK and it enables the scroll mouse in the IDE.

Scroll Mouse In VB??
how can i capture the events of the scroll mouse in VB ??


Mouse Scroll
Just as it is possible to know when keys are pressed even when the form isn't in focus, is it possible to do the same for the mouse wheel?

I'm unfamiliar with the concept behind keypress detection in this case and any examples would be appreciated.


VB Mouse Scroll In IDE
My scroll mouse would not work in the VB IDE code pages.
The attached zip contains a DLL and a read me that solved the problem.
Thought it might help others.

Mouse Scroll && VBA ???
Can I catch the mouse scroll, and stop preventing the scroll through records of a VBA Access form ??? Cause it's causing me trouble .... it scrolls without changing the selector, and so I have no control over it ....

Mouse Scroll
When a menu in a menu bar like 'file','edit' etc is clicked it drops down and opens. Is there a way to just take the mouse there and scroll the mouse and make it open?
Thanks in advance

Mouse Scroll Screen

i want to make a gamescreen larger than what shows, so i want to scroll the screen.

can sombody tell me how to make a FORM or CONTROL like a picturebox, width and height...larger than max screen.

also show me how to SCROLL THE SCREEN so i can see it working?


i know thiers plenty of examples on psc but im using a risc-os so they no good to me, i cant download.

Stop Scroll Of The Mouse
I use this line to stop people from selecting locked cells in Excel. It works perfect:

Worksheets("Sheet1").EnableSelection = xlUnlockedCells

I wonder if there is something similar to disable the scroll wheel of the mouse?

Thanks in advance.

Mouse Scroll Button
Can anyone tell me, is it possible to use mouse scroll button in VB?

As I know the mouse_click() function only returns left, right and middle button click, mouse_move() function returns mouse moving, but what about mouse scrolling? Any idea?


Mouse Scroll In A Flexgrid
the listview control enables users to scroll thru the list of items just by using the scroll button on the mouse (if they have one). does anyone know if its possible to do this in a msflexgrid control ? the only way i can see to move thru items in an msflexgrid control is by using the arrow keys on the keyboard or clicking/dragging the scroll bar on the right edge of the grid.

Copyright 2005-08, All rights reserved