IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

mise en forme Excel en vb.net


Sujet :

Windows Forms

  1. #1
    Membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Juin 2006
    Messages
    104
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juin 2006
    Messages : 104
    Points : 58
    Points
    58
    Par défaut 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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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:
    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

  2. #2
    Membre du Club
    Profil pro
    Étudiant
    Inscrit en
    Juin 2006
    Messages
    104
    Détails du profil
    Informations personnelles :
    Âge : 36
    Localisation : France, Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juin 2006
    Messages : 104
    Points : 58
    Points
    58
    Par défaut
    Rebonjour,

    Comment est il possible d'encadrer une plage via code en vb.net

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
     
     appExcel = New Microsoft.Office.Interop.Excel.Application
     
             wbExcel = appExcel.ActiveWorkbook
     
            appExcel.Sheets(MoisEtAnnee).Activate()
            wsExcel = wbExcel.ActiveSheet
     
     
     With
     wsExcel.Range("A" & y + 1 & ":I" & y + 1).Borders
                .LineStyle = xlContinuous
                .Weight = xlThin
                .ColorIndex = xlAutomatic
            End With
    il ne reconnait pas le "xlContinuous" " il me dit qu'il n'est pas déclaré.

  3. #3
    Membre confirmé Avatar de joKED
    Profil pro
    Imposteur en chef
    Inscrit en
    Février 2006
    Messages
    337
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Imposteur en chef

    Informations forums :
    Inscription : Février 2006
    Messages : 337
    Points : 458
    Points
    458
    Par défaut
    Dans mes souvenirs, la classe Range expose une méthode nommée BorderAround. Très utile pour encadrer ^^
    Tant va la cruche à l'eau qu'à la fin y'a plus d'eau.

  4. #4
    Rédacteur/Modérateur
    Avatar de Skalp
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Novembre 2006
    Messages
    1 694
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Novembre 2006
    Messages : 1 694
    Points : 2 927
    Points
    2 927

Discussions similaires

  1. Outputquery et mise en forme excel
    Par devdev dans le forum VBA Access
    Réponses: 2
    Dernier message: 10/04/2009, 17h30
  2. [A-03] Mise en forme Excel dans macro access
    Par elfiestador dans le forum VBA Access
    Réponses: 2
    Dernier message: 03/02/2009, 12h15
  3. mise en forme excel
    Par roico dans le forum VBA Access
    Réponses: 4
    Dernier message: 21/05/2007, 12h36
  4. Mise en forme Excel
    Par Xav++ dans le forum C++Builder
    Réponses: 16
    Dernier message: 12/06/2006, 16h30
  5. Mise en forme EXCEL pendant exportation ACCESS
    Par Mr White dans le forum Access
    Réponses: 3
    Dernier message: 03/01/2006, 16h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo