1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
\documentclass[dvipsnames,cmyk]{article}% autres choix : report, book
\usepackage[utf8]{inputenc}% encodage du fichier source
\usepackage[T1]{fontenc}% gestion des accents (pour les pdf)
\usepackage[francais]{babel}% rajouter éventuellement english, greek, etc.
\usepackage{textcomp}% caractères additionnels
\usepackage{amsmath,amssymb}% pour les maths
\usepackage{lmodern}% remplacer éventuellement par txfonts, fourier, etc.
\usepackage[a4paper]{geometry}% taille correcte du papier
\usepackage{graphicx}% pour inclure des images
\usepackage{xcolor}% pour gérer les couleurs
\usepackage{microtype}% améliorations typographiques
\usepackage{listings,xcolor}
\title{VBA}
\makeindex
\usepackage{hyperref}% gestion des hyperliens
\hypersetup{pdfstartview=XYZ}% zoom par défaut
%-------------------------------------------------------------------
% CODE VBA DANS LATEX
%-------------------------------------------------------------------
\lstset
{
breaklines=true,
tabsize=3,
showstringspaces=false
}
\lstdefinestyle{Common}
{
extendedchars=\true,
language=VBScript,
frame=single,
%===========================================================
framesep=3pt,%expand outward.
framerule=0.4pt,%expand outward.
xleftmargin=3.4pt,%make the frame fits in the text area.
xrightmargin=3.4pt,%make the frame fits in the text area.
%===========================================================
%rulecolor=\color{Red}
}
\lstdefinestyle{A}
{
style=Common,
%backgroundcolor=\color{Yellow!10},
basicstyle=\scriptsize\color{Black}\ttfamily,
keywordstyle=\color{Blue},
%identifierstyle=\color{Cyan},
stringstyle=\color{Red},
commentstyle=\color{Green}
}
%-------------------------------------------------------------------
% FIN CODE
%-------------------------------------------------------------------
\begin{document}
%---------------------------------------------------------------------
% TITRE ET SOMMAIRE
%---------------------------------------------------------------------
\maketitle
\clearpage
\tableofcontents
\clearpage
%---------------------------------------------------------------------
% INSTRUCTIONS
%---------------------------------------------------------------------
\section{Instructions}
\begin{lstlisting}[style=A]
Sub Titre()
Dim cellTitre As Range
For Each cellTitre In Worksheets("tableau des salaires").Range("E2:E16")
Select Case cellTitre
Case Is = "Vendeur"
cellTitre.Font.Color = RGB(0, 255, 0)
Case Is = "Ouvrier"
cellTitre.Font.Color = RGB(0, 0, 255)
Case Is = "Secrétaire"
cellTitre.Font.Color = RGB(204, 51, 204)
Case Is = "Administrateur"
cellTitre.Font.Color = RGB(204, 255, 0)
End Select
Next
End Sub
\end{lstlisting}
\end{document} |
Partager