PDA

View Full Version : Disabling ActiveXControls Prompt



ChloeRadshaw
06-05-2009, 03:09 PM
I ve been fighting with this for a while now and cannot get to the bottom of this

I have used a spreadsheet control on my application (for good reason) and it works smoothly

The problem is I get the following message: "This application is about to initalise ActiveXControls"

Has anyone else seen this and is there an easy way to disable this?

Oorang
06-05-2009, 07:01 PM
Hi Chloe,
Sorry but you either need to remove the killbit (http://support.microsoft.com/kb/240797) which can compromise the security of the machine. Or you will need switch to safe control. May I ask what necessitated the need for this control?

Kenneth Hobs
06-05-2009, 07:25 PM
Try the registry hack that I explained in this thread. http://www.vbaexpress.com/forum/showthread.php?t=26942

ChloeRadshaw
06-06-2009, 02:22 AM
Yes quite simply I need a grid to display a ton of data - A multi column list box doesnt look right

You dont have scrolling and you also dont have grid lines.

My only option was a spreadsheet control.....

What would you have done? Any ideas?

Oorang
06-06-2009, 02:41 AM
I would switch over to the Microsoft List View Control. This is still considered a safe control and had a lot more power than a listbox. If you need help with that, I would be happy to assist.

ChloeRadshaw
06-06-2009, 04:41 AM
Can you provide an example of the istview control in action - I just played around with it and I see two things:
1) I still get prompted about Active X Controls.
2) There is no easy way to set gridlines....

Any help much appreciated.

ChloeRadshaw
06-11-2009, 01:31 AM
Oorang - Can you show me how to do this please?

Oorang
06-11-2009, 06:56 AM
To use just create a userform and throw a listview in it.
Option Explicit
Private Sub UserForm_Initialize()
Dim lv As MSComctlLib.ListView
'Set up listview:
'If in Access:
'Set lv = Me.ListView1.Object
'If in anything else:
Set lv = Me.ListView1
ConfigureListView lv
LoadWorksheetIntoListView Sheet1, lv
End Sub
Private Sub ConfigureListView(ByVal lv As MSComctlLib.ListView)
lv.View = lvwReport
lv.Gridlines = True '<------
End Sub
Private Sub LoadWorksheetIntoListView(ByVal ws As Excel.Worksheet, ByVal lv As _
MSComctlLib.ListView)
Dim cll As Excel.Range
Dim li As MSComctlLib.ListItem
Dim lsi As MSComctlLib.ListSubItem
Dim lngColLeft As Long
Dim lngColTwo As Long
Dim lngColRight As Long
Dim lngCol As Long
Dim lngRowTop As Long
Dim lngRowBottom As Long
Dim lngRow As Long
Dim blnColor As Boolean
'Get headers
lngRowTop = ws.UsedRange.Row
For Each cll In Intersect(ws.UsedRange, ws.Rows(lngRowTop))
lv.ColumnHeaders.Add Text:=cll.Value
Next
lngRowBottom = ws.UsedRange.Rows.Count + lngRowTop - 1&
'Load data:
lngColLeft = ws.UsedRange.Column
lngColRight = ws.UsedRange.Columns.Count + lngColLeft - 1&
lngColTwo = lngColLeft + 1&
For lngRow = lngRowTop + 1& To lngRowBottom
Set li = lv.ListItems.Add(Text:=ws.Cells(lngRow, lngColLeft))
If blnColor Then li.ForeColor = &HA083A0
For lngCol = lngColTwo To lngColRight
Set lsi = li.ListSubItems.Add(Text:=ws.Cells(lngRow, lngCol))
If blnColor Then lsi.ForeColor = &HA083A0
Next
blnColor = Not blnColor
Next
End Sub