Is there a way with VBA? Apart from...[insert RobDog's favourite app here]
Cheers
zaza
Printable View
Is there a way with VBA? Apart from...[insert RobDog's favourite app here]
Cheers
zaza
:D
You mean like apply the styles to a outlook form or something else?
I'm thinking more to Userforms in Excel, Word etc...
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...
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. :D
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
Yeah, I was thinking of something along those lines as well, but I guess it ain't having any of it.
Ah well.
Thanks anyway,
zaza
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. :(
Mmmm, I guess I'll have to save up. Not really liking the idea of a load of redraws just for the XP styles pleasure.
:(
zaza
You mean save up for Windows XP?
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.
zaza
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
Hm, that's a bit rotten. Sure you've set the buttonstyle correctly?
:)
Of course you have.
Maybe the next version of Office will support it...or maybe not.
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.
Perhaps the XP Manifest project in my signature will help.
No Randem that wont work for this as the Form is a VBA UserForm and my issues with my images are using VSTO 2003.