mise en forme Excel en vb.net
Bonjour à tous,
J'ai une maccro excel (qui fonctionne) que je souhaite adapter dans une application vb.net.
En fait plutot que de devoir ouvrir excel et exécuter la maccro je voudrais qu'elle soit indépendante d'excel
L'idée c'est de créer une application qui centralise mes maccros en gros.
Mon problème c'est que certaine fonction de ma maccro ne fonctionne pas
Les lignes qui posent problème sont en celles en commentaire.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| wsExcel.Range("A" & x + 1 & ":H" & x + 1).Select()
With wsExcel.Application.Selection.Font
.Name = "Cambria"
.FontStyle = "Gras"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
'.Underline = wsExcel.Application.Selection.xlUnderlineStyleNone
.Color = 255
.TintAndShade = 0
' .ThemeFont = xlThemeFontMinor
End With
With wsExcel.Application.Selection.Borders
'.LineStyle = xlContinuous
'.Weight = xlThin
'.ColorIndex = xlAutomatic
End With |
Voici l'erreur:
Citation:
L'exception System.MissingMemberException n'a pas été gérée
Message="Le membre public 'xlUnderlineStyleNone' du type 'Range' est introuvable."
Source="Microsoft.VisualBasic"
StackTrace:
à Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
à Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
à Moulinette.Moulinette.MiseEnPagePiscines() dans C:\Documents and Settings\pe\Mes documents\Visual Studio 2005\Projects\Moulinette\Moulinette\Moulinette.vb:ligne 1462
à Moulinette.Moulinette.Button_Activer_Piscines_Click(Object sender, EventArgs e) dans C:\Documents and Settings\pe\Mes documents\Visual Studio 2005\Projects\Moulinette\Moulinette\Moulinette.vb:ligne 861
à System.Windows.Forms.Control.OnClick(EventArgs e)
à System.Windows.Forms.Button.OnClick(EventArgs e)
à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
à System.Windows.Forms.Control.WndProc(Message& m)
à System.Windows.Forms.ButtonBase.WndProc(Message& m)
à System.Windows.Forms.Button.WndProc(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
à System.Windows.Forms.Application.Run(ApplicationContext context)
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
à Moulinette.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81
à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
à System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
à System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
à System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
à System.Activator.CreateInstance(ActivationContext activationContext)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
j'ai besoin d'un peu d'aide pour réctifier le problème