Since there is no way to attach the manifest file to the file, which wouldnt work anyways since its not an app, you may be able to attach it for the application itself but this could cause issues since it probably areay has code in it to apply the visual styles. This is a very good idea since the actual Form itself does draw using the visual style but not for its containing controls. Let me try a test. Be back...
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Ok, I tried just using the API code to turn on the styles but no luck, probably doesnt work without the manifest file. I am tempted to try the manifest but dont want to crash my office.
My feeling is that since its using the MS Forms 2.0 Object Library and not the Windows Commn Controls 6.0 it will not work.
Here is what I tried in an Excel UserForm with some command buttons on it...
VB Code:
Option Explicit
Private Type tagInitCommonControlsEx
lngsize As Long
lngICC As Long
End Type
Private Declare Function InitCommonControlsEx Lib "comctl32.dll" (iccex As tagInitCommonControlsEx) As Boolean
Private Const ICC_USEREX_CLASSES As Long = &H200
Private Sub UserForm_Initialize()
InitCommonControlsVB
End Sub
Private Function InitCommonControlsVB() As Boolean
On Error Resume Next
Dim iccex As tagInitCommonControlsEx
'Ensure CC Available:
With iccex
.lngsize = LenB(iccex)
.lngICC = ICC_USEREX_CLASSES
End With
InitCommonControlsEx iccex
InitCommonControlsVB = (Err.Number = 0)
On Error GoTo 0
End Function
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Another option is to have code like Wokas that manually draws the buttons already in the XP Visual Style applied. It will probably work but is allot just to get the XP Style on a VBA UserForm.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Actually, I meant for VS Tools. I believe it is possible therein (just as anything is possible in VB.Net... ) although you may correct me at will. I already run XP, and Office XP.
But it isn't that important, I just thought it might make userforms look a bit nicer, that's all. And a bit more consistent with the .Net parts of my apps.
Ok, but I still think something may be missing or undo-able in VSTO 2003. check out my screen shots. First is without the VS enabled and the second has it enabled just like you do in a VB.NET app.
The userforms button does not change but the msgbox buttons button does.
VB Code:
#Region "Generated initialization code"
' Default constructor.
Public Sub New()
Application.EnableVisualStyles()
Application.DoEvents()
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
The thing is that so far I have not found the proper way to access a userform in vsto. I had to write vba code in the workbook to show the userform. the vsto only is applying the V Styles. There is not a .FlatStyle for buttons but I'm still looking.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.