ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Please help with AddItem method (https://www.excelbanter.com/excel-programming/295524-please-help-additem-method.html)

Shilps

Please help with AddItem method
 
Hi
I have posted this query before but got no response that would solve my proble
I have a code as below which when I run gives "Run-Time Error 70: Permission Denied" while it is working fine with other comboxes
read3 =
While Worksheets("QUERY_BUILDER").Range("AR" + CStr(read3)).Value < Empt
Worksheets("QUERY_BUILDER").ComboBox6.AddItem CStr(Worksheets("QUERY_BUILDER").Range("AR" + CStr(read3)).Value
read3 = read3 +
Wen
Whenever I run this code it gives "Run-Time error" Permission Denied
This code is working for other comboboxes
Please tell me why is this behaving this way and what should I do
TIH

patrick molloy

Please help with AddItem method
 
If you didn't get the answer you wanted the I assume you
know the answer. On the other hand, perhaps re-phrase the
question. This news group has a lot of people that try
very harde to provide solutions.
The following code works fine - I tidied your up and was
not able to reproduce your problem

Sub LoadCB6()
Dim read3 As Long
read3 = 2
With Worksheets("QUERY_BUILDER")
.ComboBox6.Clear
Do While .Cells(read3, "AR") < ""
.ComboBox6.AddItem .Cells(read3, "AR").Value
read3 = read3 + 1
Loop
End With

End Sub


-----Original Message-----
Hi,
I have posted this query before but got no response that

would solve my problem
I have a code as below which when I run gives "Run-Time

Error 70: Permission Denied" while it is working fine
with other comboxes.
read3 = 2
While Worksheets("QUERY_BUILDER").Range("AR" + CStr

(read3)).Value < Empty
Worksheets("QUERY_BUILDER").ComboBox6.AddItem CStr

(Worksheets("QUERY_BUILDER").Range("AR" + CStr
(read3)).Value)
read3 = read3 + 1
Wend
Whenever I run this code it gives "Run-Time error"

Permission Denied.
This code is working for other comboboxes.
Please tell me why is this behaving this way and what

should I do?
TIH
.


Tom Ogilvy

Please help with AddItem method
 
Here is the help for error 70

Permission denied (Error 70)
Specifics

An attempt was made to write to a write-protected disk or to access a locked
file. This error has the following causes and solutions:

a.. You tried to open a write-protected file for sequential Output or
Append.
Open the file for Input or change the write-protection attribute of the
file.

b.. You tried to open a file on a disk that is write-protected for
sequential Output or Append.
Remove the write-protection device from the disk or open the file for
Input.

c.. You tried to write to a file that another process locked.
Wait to open the file until the other process releases it.

d.. You attempted to access the registry, but your user permissions don't
include this type of registry access.
On 32-bit Microsoft Windows systems, a user must have the correct
permissions for access to the system registry. Change your permissions or
have them changed by the system administrator.

For additional information, select the item in question and press F1.



I suspect that some file or registry entry associated with your control is
screwed up. I would delete the control. Then I would close excel and clean
out the temp directory including removing any subdirectories in the temp
directory that include excel or vba in the name.



Then re-open excel and add a combobox and name it to ComboboBox6.



Then see if you get the error.



--

Regards,

Tom Ogilvy



"Shilps" wrote in message
...
Hi,
I have posted this query before but got no response that would solve my

problem
I have a code as below which when I run gives "Run-Time Error 70:

Permission Denied" while it is working fine with other comboxes.
read3 = 2
While Worksheets("QUERY_BUILDER").Range("AR" + CStr(read3)).Value < Empty
Worksheets("QUERY_BUILDER").ComboBox6.AddItem

CStr(Worksheets("QUERY_BUILDER").Range("AR" + CStr(read3)).Value)
read3 = read3 + 1
Wend
Whenever I run this code it gives "Run-Time error" Permission Denied.
This code is working for other comboboxes.
Please tell me why is this behaving this way and what should I do?
TIH





All times are GMT +1. The time now is 10:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com