lock all columns in a listview on a userform

possible to no permit the resize of all columns in a listview in a userform?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

have a look at the autoresizecolumns method

set it to ColumnHeaderAutoResizeStyle.None
tina2009Author Commented:
but in a listview in a vba userform for excel?
Are your sure?
sorry me.
Martin LissOlder than dirtCommented:
Add this to your code.

ListView1.HideColumnHeaders = True

Then create labels that contain your "header" text and position them over the listview columns..
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

tina2009Author Commented:
but i need HideColumnHeaders =false!
i need to use this event:

Private Sub ListView1_ColumnClick(ByVal ColumnHeader As _
Martin LissOlder than dirtCommented:
Use Label1_Click() instead.
tina2009Author Commented:
found a perfect soluction!
resolved my self.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Martin LissOlder than dirtCommented:
So that I can learn something, can you show me the code you found?
tina2009Author Commented:

but only a prob....
when exit with unload me, peraphs a few function in bas module modLockLVCols of this project, freeze a form!

perphs i need to destrioed the function in unload me statement?

you can use:

(0 is the first column in listview)

Subclass Me.ListView1.hWnd, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
Martin LissOlder than dirtCommented:
I've used subclassing in VB6 to do exactly what you want to do, and so the first thing I tried was to use the same code in VBA but it didn't work and I couldn't find solution that did work. It's not surprising that you are still having a problem since even in VB6 (which is more robust than VBA) you can have problems if you aren't careful.

I encourage you to keep looking for a solution by Googling things like safe VBA subclassing but I don't understand why my solution won't work for you.
Martin LissOlder than dirtCommented:
Here is a working example where the columns are locked and clicking the labels executes the ListView1_ColumnClick event even though the columns are hidden.
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.