VBA2DotNet
1 Excel, VBA, VB.Net
Product of the Microsoft Office pack, Excel is the most commonly used spreadsheet programs. All along its history, Excel has been improved with many possibilities, especially with the support of VBA language (Visual Basic for Applications). This interpreted language lets you quickly develop real softwares, writing files, accessing databases... embedded in a simple workbook.
This powerfull capability has wrong sides :
- Excel-VBA applications can contain malwares. Therefore, Excel shows an alert message each time a workbook containing VBA code is opened (except if the workbook is signed).
- Comfort of development, handy even for non-computer engineers, can lead to the staging of IT solutions that become strategical for the company, beyond the controled and secured development processes.
Facing these issues, Microsoft has annonced that it has stopped the support of VBA language, although current versions of Excel still let users run and maintain Excel-VBA applications.
At the same time, the .Net framework provided by Microsoft allows to keep on implementing applications that use Excel features (or others products of Office pack), by the use of interoperability librairies (Interop).
.Net supports several languages : VB, C#, J#... but it is said that possibilities of Interop to use Excel are more efficient in VB language. Added with that, the syntax of VB.Net is the closest to the one of VBA. Therefore it is natural to prefer conversion of VBA into VB.Net.
2 Migration from Excel-VBA into Interop-VB.Net
To run an Excel-VBA application, the user opens the Excel workbook that embed the VBA code. Usually, the code is executed when the user makes an action (ex: clics on a button) or at the opening of the workbook. Most of evolved applications have a start point that opens an input userform.
Here is an example of an operating principle for user's applications migrated in VB.Net Interop-Excel : The entry point will be a program (.exe) whose launch will open the main input form, will start an Excel instance and will load into it the original workbook with its VBA code previously removed.
But it is mandatory to think by yourself at the way your application migrated in VB.Net will use Excel. VBA2DotNet will help you to convert the code and to import userforms in your new development framework (Visual Studio / Visual Basic Express).
3 Using of VBA2DotNet
VBA2DotNet works on the modules, class modules and userforms exported from your Excel-VBA workbook.
It brings automation of many modifications of the code, whether they are due to the evolution of the language syntax, the access to Interop library, the differences of the userform management between VBA and .Net...
Furthermore, VBA2DotNet creates the "Designer.vb" modules (main attributes of standard controles) that generate forms, which avoids to have to recreate manually these forms.
The code converted by VBA2DotNet must be imported in a development tool (like VB Express), corrected and manually adapted.
Here are the successive steps necessary to the migration of your application with the help of VBA2DotNet :
1 Create one input folder that will contain the objects that you will export from your application and one output folder that will contain converted objects.
2 Export all modules, class modules and userforms from your VBA project into the input folder. To do so :
- Open your application in Excel.
- From the Excel VBA editor, do a right-click on each object containing VBA code,
- select "Export to a file..." (see the opposite figure ).
- Then you can close your workbook.
3 From Excel, open the VBA2DotNet workbook, make the appropriate set-up (see chapter 3.1) and run the application. It can last a few minutes, depending on the size of the files to process.
4 If the Excel workbook of your original application contains 1 or more worksheets that will still be required to the migrated one, create a new workbook embedding only these sheets.
5 In your .Net development framework, create a new solution, import the objects contained in the output folder of VBA2DotNet.
6 Correct compilation errors, complete and adapt the code (In particular, add the instructions to open the new workbook without VBA code).
In case of trouble (compilation fails, execution aborts, running does not conform to the original one, conversion does not seem to respect documented rules...), the first thing to do is to check that the recommandations of VBA2DotNet (see chapter 3.5) are followed. Once it is made, you can contact ToolOscope for support or evolution request.
4 The tool VBA2DotNet
4.1 The project worksheet
This worksheet is the command interface of VBA2DotNet. Cells to be filled by the user are on yellow background (numbered in red from 2 to 10). Each of these cells has a comment that describes the expected content. These comments are resumed in the frame beside.
Once all input data have been entered, the user clicks on the "Run VBA2DotNet" button to get process running, in 2 stages.
At each step, Obfu-VBA reads successively all input modules (8) -that must be presents in the input folder (6). During the second step, converted modules are written in the output folder (7). The user can monitor the progress of the process by looking at the numbers of read and written lines displayed on the worksheet.
Names of .bas modules and .cls classes are preserved but their extensions become .vb (plus .Designer.vb for userforms code).
Remark : You can duplicate that worksheet in the VBA2DotNet workbook, to keep one different project sheet for each of your applications, for example.
Cells comments
1 You can duplicate this sheet in the same workbook as many times as you have different VBA projects to process.
2 Fill in the name of the sheet that contains reserved words.
Optional. If present, the sheet must exist in the same workbook.
3 Fill in the name of the sheet that contains the convertion rules to apply.
Mandatory.
4 Fill in the name of the sheet that will show the code and the detected types of variables (65530 maximum lines ).
Optional. If blank, the code will not be shown.
If present, the sheet must exist in the same workbook.
5 Fill in the name of the sheet that will show the list of identifiers.
Optional. If blank, the list will not be shown.
If present, the sheet must exist in the same workbook.
6 Fill in the path to the folder which contains VBA files to process, previously exported from Excel.
Mandatory.
7 Fill in the path to the folder which will contains VB.Net converted files. These files will have to be manually import to a new VB.Net solution to rebuild your application.
Mandatory.
8 Fill in this column the names of the VBA files exported from your Excel application, without their extension. These files have to be placed in the "Input" folder.
64 maximum files + memory limit of Excel-VBA projects.
9 Fill in the extension of each VBA file named in the cell to the left :
- cls for ModuleClass,
- bas for Modules,
- frm for UserForms.
10 Fill in Y to comment each migrated line with the name of applied rules.
Fill in N to avoid these comments.
4.2 Reserved words
This input worksheet contains reserved keywords of VBA language. It can be improved in case of lacks.
VBA2DotNet analysis each word of the processed code in order to determine the conversion rules to apply.
Some of these rules (See chapter 4) only applies to the keywords declared in this sheet.
4.3 The identifiers table
During processing, VBA2DotNet digs out all identifiers declared in your project. If the name of the identifiers table worksheet is parametered in the project worksheet, VBA2DotNet returns for each identifier its name, its type and its container (in the case of a member of a class or a user type), according to its scope (project, module or local).
4.4 The read code worksheet
Obfu-VBA writes on this worksheet (if its name is defined on the project sheet) the read and analysed code - identifiers separated from other characters. Obfu-VBA shows the type it has detected below each identifier, on 2 lines : label, reserved keyword, variable, function... and the type of the container.
These informations can be usefull to understand what rules are applied.
4.5 The help worksheet
This sheet contains the list of convertion rules (see chapter 4.2), recommandations about the code to process... :
- All variables must be declared (option explicit recommended) and typed (no variant by default).
- Events on controls must be declared as Private.
- Class contructors et destructors must be declared Private.
- Class constructor must be written "Class_Initialize" (Pay attention to the case).
- Class destructor must be written "Class_Terminate" (Pay attention to the case).
- Identifiers must be written precisely the same way (case, accents...).
- Avoid giving the same name at a function (or sub) and a type.
- Avoid using accents in identifiers.
- Get, Set or Let of a same property must be gathered in the same place in the code.
...And recommandation after the code has been processed :
- Check how the rules with a warning on the table at chapter 4.2 have been processed.
- When you open a migrated form in Visual Studio, if it is not shown on the screen (its Designer.vb code is shown instead), check the events declarations in the .vb code.
- Once the corrections have been made, save and close the project, then re-open it.
- Initialize tables values !
4.6 The parameters of convertion rules
Convertion rules are listed at chapter 4. Amongst those, the rules herebelow need parameters : They are defined on the "Rules" worksheet.
- DefAttrb : If an object of type Input1 has no attribute, the default attribute Output1 is added.
- ReplAttrb : For objects of type Input1, the attribute Input2 is replaced by Output1.
- Preffx : If the identifier Input1 qualifies no object, it is prefixed with Output1.
- Call : If the identifier Input1 is not preceded by the instruction Call, Call is added before.
- ReplEvent : The event Input2 of a control (Input1 is always equal to "Control") is replaced by Output1.
- ReplReserv : The reserved word Input1 is replaced by Output1.
- ReplIdent : If the identifier Input1 qualifies no object, it is replaced by Output1.
- ReplLibel : The label Input1 is replaced by Output1.
The values of these parameters are defined on the "Rules" worksheet :
At the first lines of columns J and K, the "Rules" worksheet reminds the mapping between the names of the control in VBA and in VB.Net. It is used in the generation of the userform designer code.
5 Conversion rules
5.1 Additional declarations
In the first .bas module declared in the Project worksheet, VBA2DotNet adds the declarations of the following public variables :
- MYEXCELAPP : Excel application that will handle the migrated workbook.
- MYTOOLTIP : ToolTip object that will manage the help bubbles associated to the controls of the migrated userforms.
- _OPTIONALDEFAULT_ : String type constant that will be used as a default value for the declaration of optional parameters.
Because it will use Excel Interop librairies, the migrated application have to face the following issue : Written in VBA, a program can test the value of a cell, even if this cell does not exist or the value of this cell does not exist (as an object). In vb.Net, it is not permitted.
To implement these tests without deeply impact the converted code, VBA2DotNet proposes to use functions that will return an empty string or a zero value in the cases hereabove. These functions are declared public in the first .bas module :
- CellToString : Returns the value of the cell if it exists, else the string "".
- CellToDouble : Returns the value of the cell if it exists, else the float 0.
- CellToInt : Returns the value of the cell if it exists, else the integer 0.
If your application has no .bas module, you should add an empty one to get those declarations.
5.2 Table of conversion rules
VBA2DotNet applies the following rules. The names of the applied rules can be seen at the end of migrated lines if option 10 of the project worksheet is set to "Y" :
#ReplReserv | Replaces a reserved word of the "reserv" sheet | |
#ByRef | If ByRef and ByVal are missing, adds ByRef before the parameters of a sub or function declaration | |
#To | Manages the declaration of tables sized "m To n" | |
#Set | Manages the Set keyword in the declaration of a Property or the setting of a handler | |
#Get | Manages the declaration of the Get Property | |
#Let | Manages the declaration of the Let Property | |
#Option | Deletes deprecated options (Explicit et Base) | |
#ByVal | Deletes ByVal in front of the calling parameters in Sub or Function calls | |
#Open | Opening of a file | |
#Close | Closing of a file | |
#Line | Reading of a file | |
#Print | Writing in a file | |
#DeclString | Declaration of String typed variables : default value is set to "", except for tables and class/module variables | |
#Array | Declaration of inline tables with Array() : replaced by {} | |
#Nothing | Comparison of handlers with Is Nothing replaced by IsNothing(...) | |
#Optional | Declaration of optional parameters (hypothesis : these are Strings -or Variants converted to Strings) : default value is set to _OPTIONALDEFAULT_ | To check |
#IsMissing | Test of optional parameters presency : replaces IsMissing(...) with the comparison to the default value | To check |
#Rem | Replaces Rem by REM (rule name is not added to comments) | |
#Property | Manages the declaration of a Property or the end of a Property | |
#StructItem | Declaration of a structure member : adds Dim before | |
#DeclStruct | Déclaration of user type variables, "As" replaced by "= New" | |
#Call | Calling of Subs without the Call keyword and without parameters forbidden in vb.net + Subs declared on the Rules sheet | |
#Enum | Item of an enumeration : adds the name of the enum before if missing | |
#ReplEvent | Declaration of an event : converts event codes declared on the Rules sheet | |
#Handles | Declaration of events : New syntax | |
#CellValue | Management of Cell(*,*).Value : uses calls of CellToString ou CellToDouble functions (to be replaced manually by CellToInt if needed) | To check |
#WarnValue | An unhandled case of use of Cell(*,*).Value has been found | To check |
#ReplAttrb | Replaces the name of an attribute (see Rules sheet) | |
#DefAttrb | Sets a default attribute if none is present (see Rules sheet) | |
#ReplIdent | Replaces an identifier (see Rules sheet) | |
#Preffx | Adds a prefix, except for members (see Rules sheet) | |
#ClassInit | Replaces Class_Initialize by New | |
#ClassTerm | Replaces Class_Terminate by Finalize | |
#Unload | Closing of a userform : replaces Unload by Close() | |
#Show | Loading of a userform : replaces Show by Show() or ShowDialog() | To check |
#EOF | Manages the test of End Of File (EOF) | |
#FreeFile | Manages the allocation of a file number | To update |
#Control | In userforms, replaces parentControl.childControl by childControl | |
#UserForm | Replaces the name of the userform by Me in its module | |
#TipText | Manages ControlTipText (tests are not handled) | To check |
6 Example : The testMigratDotNet application
The small testMigratDotNet application does nothing important and has been written to test and show the functioning of VBA2DotNet. It consists of 1 code module, 1 class module and 1 userform.
Original and converted versions are shown below. The names of applied rules are shown as comments of each converted lines, with the pattern ' #rule1#rule2...
6.1 Class module "MyClass.cls"
Source code
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "MyTestClass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Public Enum myEnum
enum0
enum1
enum2
End Enum
Const MYCONST1 = "toto"
Const MYCONST2 = 3
Private mvar1 As String
Private mvar2 As Long
Public mvar3 As Boolean 'pour test de Me
Rem constructeur : son nom ne doit pas être obfuscaté
Private Sub Class_Initialize()
mvar1 = MYCONST1
mvar2 = MYCONST2
Me.mvar3 = False
DoEvents 'pourquoi ne pas le mettre ici ?
End Sub
Rem property : changement de la syntaxe
Rem le Get et Let/Set doivent être groupés dans le code
Rem le code migré doit être :
' Property var1( ) As String
' Get
' var1 = mvar1
' End Get
' Set(parm1 As String)
' mvar1 = Value
' End Set
' End Property
Friend Property Get var1() As String
var1 = mvar1
End Property
Friend Property Let var1(parm1 As String)
mvar1 = parm1
End Property
Friend Property Let var2(parm1 As Long)
mvar2 = parm1
End Property
Friend Property Get var2() As Long
var2 = mvar2
End Property
Rem destructeur : son nom ne doit pas être obfuscaté
Private Sub Class_Terminate()
Dim lEnum As myEnum
lEnum = myEnum.enum0 ' avec le nom de l'enum
MsgBox "Object of class MyTestClass destroyed !" & vbCr & "(error = " & Error & ")"
lEnum = enum1 ' sans le nom de l'enum
End Sub
Rem property Get sans Set
Friend Property Get var3() As Boolean
var3 = mvar3
End Property
Converted code
Public Class MyTestClass
' Option Explicit ' #Option
Public Enum myEnum
enum0
enum1
enum2
End Enum
Const MYCONST1 = "toto"
Const MYCONST2 = 3
Private mvar1 As String
Private mvar2 As Integer ' #ReplReserv
Public mvar3 As Boolean 'pour test de Me
Rem constructeur : son nom ne doit pas être obfuscaté
Sub New() ' #ClassInit
mvar1 = MYCONST1
mvar2 = MYCONST2
Me.mvar3 = False
Application.DoEvents ' #Preffx 'pourquoi ne pas le mettre ici ?
End Sub
Rem property : changement de la syntaxe
Rem le Get et Let/Set doivent être groupés dans le code
Rem le code migré doit être :
' Property var1( ) As String
' Get
' var1 = mvar1
' End Get
' Set(parm1 As String)
' mvar1 = Value
' End Set
' End Property
Friend Property var1() As String ' #Property
Get ' #Get
var1 = mvar1
End Get ' #Get
Set (parm1 As String) ' #Let
mvar1 = parm1
End Set ' #Let
End Property
Friend Property var2() As Long ' #Property
Set (parm1 As Integer) ' #Let#ReplReserv
mvar2 = parm1
End Set ' #Let
Get ' #Get
var2 = mvar2
End Get ' #Get
End Property
Rem destructeur : son nom ne doit pas être obfuscaté
Protected Overrides Sub Finalize() ' #ClassTerm
Dim lEnum As myEnum
lEnum = myEnum.enum0 ' avec le nom de l'enum
Call MsgBox("Object of class MyTestClass destroyed !" & vbCr & "(error = " & Error & ")") ' #Call
lEnum = myEnum.enum1 ' #Enum ' sans le nom de l'enum
End Sub
Rem property Get sans Set
Friend Property var3() As Boolean ' #Property
Get ' #Get
var3 = mvar3
End Get ' #Get
End Property
End Class
6.2 Code module "MyModule.bas"
Source code
Attribute VB_Name = "MyModule"
Option Explicit
Public Type myType
mvar1 As String
mvar2 As Long
mvar3 As Boolean
End Type
Const MYCONST1 = "MyModule"
Const MYCONST2 = 4
Public Type my2ndType
mvar2(1 To 5) As myType
mvar1 As Boolean
End Type
Rem sub de test
Private Sub monsubPrive(ByRef pparm1 As String, _
ByVal pparm2 As Boolean, pparm3 As myType, Optional pParamOption As Variant)
Dim mvar1 As String, lvarA As Boolean, mvar2 As my2ndType, lNum As Integer
pparm3.mvar1 = pparm1
With pparm3
.mvar2 = -3
End With
lNum = 1
With mvar2
While lNum <= 5 _
And .mvar2(lNum).mvar3 = True
If .mvar2(lNum).mvar2 > 0 Then MsgBox Str(lNum) & " : " & .mvar2(lNum).mvar1 ' call implicite après un THEN
lNum = lNum + 1
Wend ' Wend a remplacer en .Net _
suite du commentaire
End With
Rem 3 identificateurs mvar2 qui désignent tous des variables différentes
If Not (mvar2.mvar2(1)) Then ' 5 + pparm3.mvar2 Is Nothing
mvar2.mvar2(5 + pparm3.mvar2).mvar2 = -1234567
End If
lvarA = True
mvar1 = MYCONST1
MsgBox "monsubPrive : " & pparm3.mvar1 & " " & mvar1
If IsMissing(pParamOption) Then MsgBox "parametre optionel non renseigné"
End Sub
Public Sub lance()
Dim laClasse As MyTestClass, var2 As String, mvar1 As myType, lEnumItem As Integer
If laClasse Is Nothing Then
Set laClasse = New MyTestClass
End If
With ActiveSheet
.Cells(2, 2) = "Test démarré"
End With
Rem ne pas confondre les 2 "var2"
laClasse.var2 = 12345 - 1234
var2 = " toto "
monsubPrive "test", True, mvar1
Rem constantes Office ou Excel ou... à préfixer en vb.net
lEnumItem = xlNext
lEnumItem = xlPart
lEnumItem = xlDown
lEnumItem = xlValues
lEnumItem = xlWhole
lEnumItem = msoLineSingle
lEnumItem = msoTrue
lEnumItem = msoLineSolid
lEnumItem = vbRed
lEnumItem = vbFromUnicode
lEnumItem = xlLastCell
MyUserForm.Show 'affichage modal
MyUserForm.Show (vbModeless) 'affichage non modal
Application.Worksheets("Feuil1").Cells(2, 2).Value = ""
Application.Worksheets("Feuil1").Cells(3, 2).Value = ""
If Cells(1, 1).Value = "" Then _
MsgBox ("cellule vide")
If Worksheets("Feuil1").Cells(1, 1).Value <> "" Then _
var2 = Worksheets("Feuil1").Cells(1, 1).Value
If Application.Worksheets("Feuil1").Cells(1, 1).Value > -1 Then
lEnumItem = Application.Worksheets("Feuil1").Cells(1, 1).Value
End If
If Worksheets("Feuil1").Cells(1, 1).Value = "Toto" Then _
MsgBox ("cellule contient Toto")
End Sub
Rem pour test migration fonctions IO de fichiers
Private Sub recopieFichier(pNomFicEnt As String, pNomFicSor As String)
Dim lLigne As String, lNoligne As Long, lNoFicEnt As Integer, _
lNoFicSor As Integer, lContinueSiErreur As Boolean, lStop As Boolean
Rem ouverture du fichier de script
On Error GoTo gestionErreurFichier
lNoFicEnt = FreeFile
lNoFicSor = FreeFile
Open pNomFicEnt For Input As lNoFicEnt
Open pNomFicSor For Output As lNoFicSor
Rem boucle de lecture du fichier
lNoligne = 0
lStop = False
While Not (EOF(lNoFicEnt) Or lStop)
Line Input #lNoFicEnt, lLigne ' lit la ligne en entrée
Rem recopie la ligne en sortie
Print #lNoFicSor, lLigne
lNoligne = lNoligne + 1
If lNoligne > 100 Then _
lStop = True
Wend
Rem fermeture des fichiers
Close #lNoFicEnt
Close #lNoFicSor
On Error GoTo 0
Exit Sub
gestionErreurFichier:
MsgBox "Impossible d'ouvrir le fichier"
Err.Number = 0
Exit Sub
End Sub
Converted code
Public Module MyModule
Public MYEXCELAPP As Microsoft.Office.Interop.Excel.Application
Public MYTOOLTIP As System.Windows.Forms.ToolTip
Public Const _OPTIONALDEFAULT_ As String = "$$DEFAULT$$"
Public Function CellToString(ByRef pCell As Microsoft.Office.Interop.Excel.Range) As String
If pCell Is Nothing Then
CellToString = New String("")
elseIf pCell.Value Is Nothing Then
CellToString = New String("")
Else
CellToString = pCell.Value
End If
End Function
Public Function CellToDouble(ByRef pCell As Microsoft.Office.Interop.Excel.Range) As Double
If pCell Is Nothing Then
CellToDouble = 0.0#
ElseIf pCell.Value Is Nothing Then
CellToDouble = 0.0#
Else
CellToDouble = Val(pCell.Value)
End If
End Function
Public Function CellToInt(ByRef pCell As Microsoft.Office.Interop.Excel.Range) As Integer
If pCell Is Nothing Then
CellToInt = 0
ElseIf pCell.Value Is Nothing Then
CellToInt = 0
Else
CellToInt = Int(Val(pCell.Value))
End If
End Function
' Option Explicit ' #Option
Public Structure myType ' #ReplReserv
Dim mvar1 As String ' #StructItem
Dim mvar2 As Integer ' #StructItem#ReplReserv
Dim mvar3 As Boolean ' #StructItem
End Structure ' #ReplReserv
Const MYCONST1 = "MyModule"
Const MYCONST2 = 4
Public Structure my2ndType ' #ReplReserv
Dim mvar2() As myType ' #StructItem#To
Dim mvar1 As Boolean ' #StructItem
End Structure ' #ReplReserv
Rem sub de test
Private Sub monsubPrive(ByRef pparm1 As String, ByVal pparm2 As Boolean, ByRef pparm3 As myType, Optional ByRef pParamOption As String = _OPTIONALDEFAULT_) ' #ByRef#Optional#ByRef#ReplReserv
Dim mvar1 As String = "", lvarA As Boolean, mvar2 = New my2ndType, lNum As Short ' #DeclString#DeclStruct#ReplReserv
pparm3.mvar1 = pparm1
With pparm3
.mvar2 = -3
End With
lNum = 1
With mvar2
While lNum <= 5 And .mvar2(lNum).mvar3 = True
If .mvar2(lNum).mvar2 > 0 Then MsgBox(Str(lNum) & " : " & .mvar2(lNum).mvar1) ' #Call ' call implicite après un THEN
lNum = lNum + 1
End While ' #ReplReserv ' Wend a remplacer en .Net suite du commentaire
End With
Rem 3 identificateurs mvar2 qui désignent tous des variables différentes
If Not (mvar2.mvar2(1)) Then ' 5 + pparm3.mvar2 Is Nothing
mvar2.mvar2(5 + pparm3.mvar2).mvar2 = -1234567
End If
lvarA = True
mvar1 = MYCONST1
Call MsgBox("monsubPrive : " & pparm3.mvar1 & " " & mvar1) ' #Call
If pParamOption = _OPTIONALDEFAULT_ Then MsgBox("parametre optionel non renseigné") ' #IsMissing#Call
End Sub
Public Sub lance()
Dim laClasse As MyTestClass, var2 As String = "", mvar1 = New myType, lEnumItem As Short ' #DeclString#DeclStruct#ReplReserv
If IsNothing(laClasse ) Then ' #Nothing
laClasse = New MyTestClass ' #Set
End If
With MYEXCELAPP.ActiveSheet ' #Preffx
.Cells(2, 2) = "Test démarré"
End With
Rem ne pas confondre les 2 "var2"
laClasse.var2 = 12345 - 1234
var2 = " toto "
Call monsubPrive("test", True, mvar1) ' #Call
Rem constantes Office ou Excel ou... à préfixer en vb.net
lEnumItem = Microsoft.Office.Interop.Excel.XlSearchDirection.xlNext ' #Preffx
lEnumItem = Microsoft.Office.Interop.Excel.XlLookAt.xlPart ' #Preffx
lEnumItem = Microsoft.Office.Interop.Excel.XlDirection.xlDown ' #Preffx
lEnumItem = Microsoft.Office.Interop.Excel.XlFindLookIn.xlValues ' #Preffx
lEnumItem = Microsoft.Office.Interop.Excel.XlLookAt.xlWhole ' #Preffx
lEnumItem = Microsoft.Office.Core.MsoLineStyle.msoLineSingle ' #Preffx
lEnumItem = Microsoft.Office.Core.MsoTriState.msoTrue ' #Preffx
lEnumItem = Microsoft.Office.Core.MsoLineDashStyle.msoLineSolid ' #Preffx
lEnumItem = System.Drawing.ColorTranslator.ToOle(Color.Red) ' #ReplIdent
lEnumItem = vbFromUnicode
lEnumItem = Microsoft.Office.Interop.Excel.Constants.xlLastCell ' #Preffx
MyUserForm.ShowDialog(???nom_du_owner???) ' #Show 'affichage modal
MyUserForm.Show() ' #Show 'affichage non modal
MYEXCELAPP.Application.Worksheets("Feuil1").Cells(2, 2).Value = "" ' #Preffx
MYEXCELAPP.Application.Worksheets("Feuil1").Cells(3, 2).Value = "" ' #Preffx
If CellToString(MYEXCELAPP.Cells(1, 1)) = "" Then MsgBox(("cellule vide")) ' #Preffx#CellValue#Call
If CellToString(MYEXCELAPP.Worksheets("Feuil1").Cells(1, 1)) <> "" Then var2 = CellToString(MYEXCELAPP.Worksheets("Feuil1").Cells(1, 1)) ' #Preffx#CellValue#Preffx#CellValue
If CellToDouble(MYEXCELAPP.Application.Worksheets("Feuil1").Cells(1, 1)) > -1 Then ' #Preffx#CellValue
lEnumItem = CellToDouble(MYEXCELAPP.Application.Worksheets("Feuil1").Cells(1, 1)) ' #Preffx#CellValue
End If
If CellToString(MYEXCELAPP.Worksheets("Feuil1").Cells(1, 1)) = "Toto" Then MsgBox(("cellule contient Toto")) ' #Preffx#CellValue#Call
End Sub
Rem pour test migration fonctions IO de fichiers
Private Sub recopieFichier(ByRef pNomFicEnt As String, ByRef pNomFicSor As String) ' #ByRef#ByRef
Dim lLigne As String = "", lNoligne As Integer, lNoFicEnt As Short, lNoFicSor As Short, lContinueSiErreur As Boolean, lStop As Boolean ' #DeclString#ReplReserv#ReplReserv#ReplReserv
Rem ouverture du fichier de script
On Error GoTo gestionErreurFichier
lNoFicEnt_file = New System.IO.FileStream(??filepath??, System.IO.FileMode.Open, System.IO.FileAccess.????) ' #FreeFile
lNoFicSor_file = New System.IO.FileStream(??filepath??, System.IO.FileMode.Open, System.IO.FileAccess.????) ' #FreeFile
lNoFicEnt = New System.IO.StreamReader(lNoFicEnt_file) ' #Open
lNoFicSor = New System.IO.StreamReader(lNoFicSor_file) ' #Open
Rem boucle de lecture du fichier
lNoligne = 0
lStop = False
While Not (lNoFicEnt.Peek() > -1 Or lStop) ' #EOF
lLigne = lNoFicEnt.ReadLine() ' #Line ' lit la ligne en entrée
Rem recopie la ligne en sortie
lNoFicSor.WriteLine(lLigne) ' #Print
lNoligne = lNoligne + 1
If lNoligne > 100 Then lStop = True
End While ' #ReplReserv
Rem fermeture des fichiers
lNoFicEnt.Close() ' #Close
lNoFicSor.Close() ' #Close
On Error GoTo 0
Exit Sub
gestionErreurFichier:
Call MsgBox("Impossible d'ouvrir le fichier") ' #Call
Err.Number = 0
Exit Sub
End Sub
End Module
6.3 UserForm "MyUserForm.frm"
Source code
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} MyUserForm
Caption = "Test VBA2DotNet"
ClientHeight = 7455
ClientLeft = 45
ClientTop = 345
ClientWidth = 4950
OleObjectBlob = "MyUserForm.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "MyUserForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private var1 As MyTestClass
Private var2 As myType
Private Sub Fermer_Click()
Worksheets("Feuil1").Cells(3, 2) = "C'est fini"
MyUserForm.Hide
Unload MyUserForm
End Sub
Private Sub TextBox1_DblClick(ByVal pCancel As msforms.ReturnBoolean)
TextBox1 = "User has double-clicked" ' il manque l'attribut ici
End Sub
Rem Initialize remplacé par l'évènement Load
Private Sub UserForm_Initialize()
Dim lTableauShapes() As String
Label1.Caption = "valeur initialisée par UserForm_Initialize"
Set var1 = New MyTestClass
With ListBox1
.Clear
.AddItem ("first")
.AddItem ("second")
.AddItem ("third")
End With
TextBox3.ControlTipText = "Some Help Text"
ReDim lTableauShapes(2)
lTableauShapes(0) = "Toto"
lTableauShapes(1) = "Tata"
lTableauShapes(2) = "Titi"
Rem remplacement de Array() par {}
On Error GoTo RangeNotFound
ActiveSheet.Shapes.Range(Array(lTableauShapes(0), lTableauShapes(1), _
lTableauShapes(2))).Select
RangeNotFound:
Err.Clear
End Sub
Private Sub CommandButton1_Click()
MsgBox "TextBox2.Value=" & var1.var1 'ne pas confondre l'instance de MyTestClass _
avec son membre de même nom
Rem les controles peuvent être qualifiés complètement ou pas du tout
MyUserForm.MultiPage1.Page2.TextBox2.Value = "-->" & var1.var1
With MyUserForm.MultiPage1
.Page2.TextBox2.Locked = True
End With
End Sub
Private Sub TextBox2_Change()
Dim mvar1 As String, var_2 As Integer, _
var_3 As Boolean 'gestion d'une ligne avec caractère de continuation
Rem les controles peuvent être qualifiés complètement ou pas du tout
var1.var1 = TextBox2.Value
Rem gestion du with : ne pas confondre la variable locale mvar1 avec le membre .mvar1
With var2
.mvar1 = "string"
.mvar2 = 123456789
.mvar3 = True
End With
End Sub
Converted code
Public Class MyUserForm
' Option Explicit ' #Option
Private var1 As MyTestClass
Private var2 = New myType ' #DeclStruct
Private Sub Fermer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Fermer.Click ' #Handles
MYEXCELAPP.Worksheets("Feuil1").Cells(3, 2) = "C'est fini" ' #Preffx
Me.Hide ' #UserForm
Me.Close() ' #Unload#UserForm
End Sub
Private Sub TextBox1_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick ' #ReplEvent#Handles
TextBox1.Text = "User has double-clicked" ' #DefAttrb ' il manque l'attribut ici
End Sub
Rem Initialize remplacé par l'évènement Load
Private Sub UserForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Load ' #ReplEvent#Handles
Dim lTableauShapes() As String
Label1.Text = "valeur initialisée par UserForm_Initialize" ' #ReplAttrb
var1 = New MyTestClass ' #Set
With ListBox1
.Items.Clear() ' #ReplAttrb
.Items.Add ("first") ' #ReplAttrb
.Items.Add ("second") ' #ReplAttrb
.Items.Add ("third") ' #ReplAttrb
End With
MYTOOLTIP.SetToolTip(TextBox3, "Some Help Text") ' #TipText
ReDim lTableauShapes(2)
lTableauShapes(0) = "Toto"
lTableauShapes(1) = "Tata"
lTableauShapes(2) = "Titi"
Rem remplacement de Array() par {}
On Error GoTo RangeNotFound
MYEXCELAPP.ActiveSheet.Shapes.Range({lTableauShapes(0), lTableauShapes(1), lTableauShapes(2)}).Select ' #Preffx#Array
RangeNotFound:
Err.Clear
End Sub
Private Sub CommandButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CommandButton1.Click ' #Handles
Call MsgBox("TextBox2.Value=" & var1.var1) ' #Call 'ne pas confondre l'instance de MyTestClass avec son membre de même nom
Rem les controles peuvent être qualifiés complètement ou pas du tout
TextBox2.Text = "-->" & var1.var1 ' #UserForm#Control#Control#Control#ReplAttrb
With MultiPage1 ' #UserForm#Control
TextBox2.ReadOnly = True ' #Control#Control#ReplAttrb
End With
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged ' #ReplEvent#Handles
Dim mvar1 As String = "", var_2 As Short, var_3 As Boolean ' #DeclString#ReplReserv 'gestion d'une ligne avec caractère de continuation
Rem les controles peuvent être qualifiés complètement ou pas du tout
var1.var1 = TextBox2.Text ' #ReplAttrb
Rem gestion du with : ne pas confondre la variable locale mvar1 avec le membre .mvar1
With var2
.mvar1 = "string"
.mvar2 = 123456789
.mvar3 = True
End With
End Sub
End Class
Designer Code
_
Partial Class MyUserForm
Inherits System.Windows.Forms.Form
'Form remplace la méthode Dispose pour nettoyer la liste des composants.
_
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Requise par le Concepteur Windows Form
Private components As System.ComponentModel.IContainer
'REMARQUE : la procédure suivante est requise par le Concepteur Windows Form
'Elle peut être modifiée à l'aide du Concepteur Windows Form.
'Ne la modifiez pas à l'aide de l'éditeur de code.
_
Private Sub InitializeComponent()
Me.Frame1 = New System.Windows.Forms.GroupBox()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.CommandButton1 = New System.Windows.Forms.Button()
Me.MultiPage1 = New System.Windows.Forms.TabControl()
Me.Page1 = New System.Windows.Forms.TabPage()
Me.Page2 = New System.Windows.Forms.TabPage()
Me.Label1 = New System.Windows.Forms.Label()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.Fermer = New System.Windows.Forms.Button()
Me.OptionButton1 = New System.Windows.Forms.RadioButton()
Me.OptionButton2 = New System.Windows.Forms.RadioButton()
Me.CheckBox1 = New System.Windows.Forms.CheckBox()
Me.CheckBox2 = New System.Windows.Forms.CheckBox()
Me.CheckBox3 = New System.Windows.Forms.CheckBox()
Me.ListBox1 = New System.Windows.Forms.ListBox()
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
Me.MultiPage2 = New System.Windows.Forms.TabControl()
Me.Page3 = New System.Windows.Forms.TabPage()
Me.Page4 = New System.Windows.Forms.TabPage()
Me.SpinButton1 = New System.Windows.Forms.NumericUpDown()
Me.TextBox3 = New System.Windows.Forms.TextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.Image1 = New System.Windows.Forms.PictureBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.Frame1.SuspendLayout()
Me.MultiPage1.SuspendLayout()
Me.Page1.SuspendLayout()
Me.Page2.SuspendLayout()
Me.MultiPage2.SuspendLayout()
Me.Page3.SuspendLayout()
Me.Page4.SuspendLayout()
CType(Me.SpinButton1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Image1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Frame1
'
Me.Frame1.Controls.Add (Me.TextBox1)
Me.Frame1.Controls.Add (Me.CommandButton1)
Me.Frame1.Location = New System.Drawing.Point(4, 12)
Me.Frame1.Name = "Frame1"
Me.Frame1.Size = New System.Drawing.Size(316, 96)
Me.Frame1.TabIndex = 0
Me.Frame1.TabStop = False
Me.Frame1.Text = "Frame number 1"
'
'TextBox1
'
Me.TextBox1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox1.MultiLine = True
Me.TextBox1.Location = New System.Drawing.Point(4, 8)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(188, 72)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "Ceci est un Userform destiné à tester le fonctionnement de Obfu-VBA."
'
'CommandButton1
'
Me.CommandButton1.Font = New System.Drawing.Font("Tahoma", 9.75!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CommandButton1.Location = New System.Drawing.Point(204, 12)
Me.CommandButton1.Name = "CommandButton1"
Me.CommandButton1.Size = New System.Drawing.Size(92, 32)
Me.CommandButton1.TabIndex = 1
Me.CommandButton1.Text = "Alert !"
Me.CommandButton1.UseVisualStyleBackColor = True
'
'MultiPage1
'
Me.MultiPage1.Controls.Add (Me.Page1)
Me.MultiPage1.Controls.Add (Me.Page2)
Me.MultiPage1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.MultiPage1.Location = New System.Drawing.Point(8, 112)
Me.MultiPage1.Name = "MultiPage1"
Me.MultiPage1.Size = New System.Drawing.Size(316, 156)
Me.MultiPage1.TabIndex = 1
Me.MultiPage1.Text = "1"
'
'Page1
'
Me.Page1.BackColor = System.Drawing.SystemColors.ButtonFace
Me.Page1.Controls.Add (Me.Label1)
Me.Page1.Controls.Add (Me.CheckBox1)
Me.Page1.Controls.Add (Me.CheckBox2)
Me.Page1.Controls.Add (Me.CheckBox3)
Me.Page1.Controls.Add (Me.ListBox1)
Me.Page1.Location = New System.Drawing.Point(3, 21)
Me.Page1.Name = "Page1"
Me.Page1.Padding = New System.Windows.Forms.Padding(3)
Me.Page1.Size = New System.Drawing.Size(312, 133)
Me.Page1.TabIndex = 0
Me.Page1.Text = ""
Me.Page1.UseVisualStyleBackColor = True
'
'Page2
'
Me.Page2.BackColor = System.Drawing.SystemColors.ButtonFace
Me.Page2.Controls.Add (Me.TextBox2)
Me.Page2.Controls.Add (Me.OptionButton1)
Me.Page2.Controls.Add (Me.OptionButton2)
Me.Page2.Controls.Add (Me.MultiPage2)
Me.Page2.Location = New System.Drawing.Point(3, 21)
Me.Page2.Name = "Page2"
Me.Page2.Padding = New System.Windows.Forms.Padding(3)
Me.Page2.Size = New System.Drawing.Size(312, 133)
Me.Page2.TabIndex = 1
Me.Page2.Text = ""
Me.Page2.UseVisualStyleBackColor = True
'
'Label1
'
Me.Label1.AutoSize = False
Me.Label1.Font = New System.Drawing.Font("Tahoma", 9!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(8, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(280, 32)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Page 1 du multipage"
'
'TextBox2
'
Me.TextBox2.Font = New System.Drawing.Font("Tahoma", 12!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox2.MultiLine = False
Me.TextBox2.Location = New System.Drawing.Point(8, 4)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(272, 28)
Me.TextBox2.TabIndex = 0
Me.TextBox2.Text = "Page 2 du multi-page"
'
'Fermer
'
Me.Fermer.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Fermer.Location = New System.Drawing.Point(228, 320)
Me.Fermer.Name = "Fermer"
Me.Fermer.Size = New System.Drawing.Size(88, 48)
Me.Fermer.TabIndex = 2
Me.Fermer.Text = "Fermer/Close"
Me.Fermer.UseVisualStyleBackColor = True
'
'OptionButton1
'
Me.OptionButton1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.OptionButton1.Location = New System.Drawing.Point(12, 40)
Me.OptionButton1.Name = "OptionButton1"
Me.OptionButton1.Size = New System.Drawing.Size(117, 20)
Me.OptionButton1.TabIndex = 1
Me.OptionButton1.TabStop = False
Me.OptionButton1.Text = "OptionButton1"
Me.OptionButton1.UseVisualStyleBackColor = True
'
'OptionButton2
'
Me.OptionButton2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.OptionButton2.Location = New System.Drawing.Point(12, 68)
Me.OptionButton2.Name = "OptionButton2"
Me.OptionButton2.Size = New System.Drawing.Size(116, 24)
Me.OptionButton2.TabIndex = 2
Me.OptionButton2.TabStop = False
Me.OptionButton2.Text = "OptionButton2"
Me.OptionButton2.UseVisualStyleBackColor = True
'
'CheckBox1
'
Me.CheckBox1.AutoSize = False
Me.CheckBox1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CheckBox1.AutoSize = True
Me.CheckBox1.Location = New System.Drawing.Point(8, 44)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(107, 20)
Me.CheckBox1.TabIndex = 1
Me.CheckBox1.Text = "CheckBox1"
Me.CheckBox1.UseVisualStyleBackColor = True
'
'CheckBox2
'
Me.CheckBox2.AutoSize = False
Me.CheckBox2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CheckBox2.AutoSize = True
Me.CheckBox2.Location = New System.Drawing.Point(8, 64)
Me.CheckBox2.Name = "CheckBox2"
Me.CheckBox2.Size = New System.Drawing.Size(101, 24)
Me.CheckBox2.TabIndex = 2
Me.CheckBox2.Text = "CheckBox2"
Me.CheckBox2.UseVisualStyleBackColor = True
'
'CheckBox3
'
Me.CheckBox3.AutoSize = False
Me.CheckBox3.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CheckBox3.AutoSize = True
Me.CheckBox3.Location = New System.Drawing.Point(8, 88)
Me.CheckBox3.Name = "CheckBox3"
Me.CheckBox3.Size = New System.Drawing.Size(104, 20)
Me.CheckBox3.TabIndex = 3
Me.CheckBox3.Text = "CheckBox3"
Me.CheckBox3.UseVisualStyleBackColor = True
'
'ListBox1
'
Me.ListBox1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ListBox1.FormattingEnabled = True
Me.ListBox1.Location = New System.Drawing.Point(132, 44)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(144, 64)
Me.ListBox1.TabIndex = 4
Me.ListBox1.Text = ""
'
'ComboBox1
'
Me.ComboBox1.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.ComboBox1.FormattingEnabled = True
Me.ComboBox1.Location = New System.Drawing.Point(220, 280)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(96, 24)
Me.ComboBox1.TabIndex = 3
Me.ComboBox1.Text = "entree1"
'
'MultiPage2
'
Me.MultiPage2.Controls.Add (Me.Page3)
Me.MultiPage2.Controls.Add (Me.Page4)
Me.MultiPage2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.MultiPage2.Location = New System.Drawing.Point(140, 40)
Me.MultiPage2.Name = "MultiPage2"
Me.MultiPage2.Size = New System.Drawing.Size(164, 84)
Me.MultiPage2.TabIndex = 3
Me.MultiPage2.Text = "0"
'
'Page3
'
Me.Page3.BackColor = System.Drawing.SystemColors.ButtonFace
Me.Page3.Controls.Add (Me.SpinButton1)
Me.Page3.Controls.Add (Me.TextBox3)
Me.Page3.Location = New System.Drawing.Point(3, 21)
Me.Page3.Name = "Page3"
Me.Page3.Padding = New System.Windows.Forms.Padding(3)
Me.Page3.Size = New System.Drawing.Size(160, 61)
Me.Page3.TabIndex = 0
Me.Page3.Text = ""
Me.Page3.UseVisualStyleBackColor = True
'
'Page4
'
Me.Page4.BackColor = System.Drawing.SystemColors.ButtonFace
Me.Page4.Controls.Add (Me.Label2)
Me.Page4.Location = New System.Drawing.Point(3, 21)
Me.Page4.Name = "Page4"
Me.Page4.Padding = New System.Windows.Forms.Padding(3)
Me.Page4.Size = New System.Drawing.Size(160, 61)
Me.Page4.TabIndex = 1
Me.Page4.Text = ""
Me.Page4.UseVisualStyleBackColor = True
'
'SpinButton1
'
Me.SpinButton1.Location = New System.Drawing.Point(128, 4)
Me.SpinButton1.Name = "SpinButton1"
Me.SpinButton1.Size = New System.Drawing.Size(28, 40)
Me.SpinButton1.TabIndex = 0
Me.SpinButton1.Text = "0"
'
'TextBox3
'
Me.TextBox3.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox3.MultiLine = False
Me.TextBox3.Location = New System.Drawing.Point(4, 4)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(112, 36)
Me.TextBox3.TabIndex = 1
Me.TextBox3.Text = ""
'
'Label2
'
Me.Label2.AutoSize = False
Me.Label2.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(4, 8)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(96, 24)
Me.Label2.TabIndex = 0
Me.Label2.Text = "Label2"
'
'Image1
'
Me.Image1.Location = New System.Drawing.Point(12, 272)
Me.Image1.Name = "Image1"
Me.Image1.Size = New System.Drawing.Size(200, 208)
Me.Image1.Size = New System.Drawing.Size(200, 208)
'
'Label3
'
Me.Label3.AutoSize = False
Me.Label3.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(216, 376)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(108, 56)
Me.Label3.TabIndex = 4
Me.Label3.Text = "Ceci est un label long qui doit tenir sur plusieurs lignes"
'
'MyUserForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(336, 525)
Me.Controls.Add (Me.Frame1)
Me.Controls.Add (Me.MultiPage1)
Me.Controls.Add (Me.Fermer)
Me.Controls.Add (Me.ComboBox1)
Me.Controls.Add (Me.Image1)
Me.Controls.Add (Me.Label3)
Me.Name = "MyUserForm"
Me.Text = "Test VBA2DotNet"
Me.Frame1.ResumeLayout(False)
Me.Frame1.PerformLayout()
Me.MultiPage1.ResumeLayout(False)
Me.MultiPage1.PerformLayout()
Me.Page1.ResumeLayout(False)
Me.Page1.PerformLayout()
Me.Page2.ResumeLayout(False)
Me.Page2.PerformLayout()
Me.MultiPage2.ResumeLayout(False)
Me.MultiPage2.PerformLayout()
Me.Page3.ResumeLayout(False)
Me.Page3.PerformLayout()
Me.Page4.ResumeLayout(False)
Me.Page4.PerformLayout()
CType(Me.SpinButton1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Image1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Frame1 As System.Windows.Forms.GroupBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents CommandButton1 As System.Windows.Forms.Button
Friend WithEvents MultiPage1 As System.Windows.Forms.TabControl
Friend WithEvents Page1 As System.Windows.Forms.TabPage
Friend WithEvents Page2 As System.Windows.Forms.TabPage
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Fermer As System.Windows.Forms.Button
Friend WithEvents OptionButton1 As System.Windows.Forms.RadioButton
Friend WithEvents OptionButton2 As System.Windows.Forms.RadioButton
Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox
Friend WithEvents CheckBox2 As System.Windows.Forms.CheckBox
Friend WithEvents CheckBox3 As System.Windows.Forms.CheckBox
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents MultiPage2 As System.Windows.Forms.TabControl
Friend WithEvents Page3 As System.Windows.Forms.TabPage
Friend WithEvents Page4 As System.Windows.Forms.TabPage
Friend WithEvents SpinButton1 As System.Windows.Forms.NumericUpDown
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Image1 As System.Windows.Forms.PictureBox
Friend WithEvents Label3 As System.Windows.Forms.Label
End Class
7 How to get VBA2DotNet ?
ToolOscope proposes to you a Shareware License :
- You would like to try VBA2DotNet : Register and download the software in full version for free. You are granted an evaluation license.
- "What's the need ?" : Remove from your work spaces all your copies of the software and all by-products generated by it.
- "This software is not bad, but..." : Ask for an evolution or a correction and describe precisely your needs.
- "It works and I will keep on using it or its by-products" : Send your greetings to its creator.
For all this, please go to the User Space.
Don't modify this software, don't broadcast it : ToolOscope manages that.