You are on page 1of 13

1.

2.
3.

FORM
ULARI
O

Abrir el archivo Formulario


Ir a la hoja con el nombre BASE DE DATOS
Escribir su nombre en la celda B2

PROCEDIMIENTO HABILITAR MACROS


4.

Ir a la ficha DESARROLLADOR
a. Seguridad de la macros y configurar

b. Seleccionar el botn de opciones Habilitar todas las macros (no recomendado; puede
ejecutarse cdigo posiblemente peligroso)
c. Seleccionar la casilla de verificacin Confiar en el acceso al modelo de objetos de
proyectos VBA
d. Clic en el botn aceptar

PROCEDIMIENTO IR AL EDITOR VISUAL BASIC


5.

Ir a la ficha DESARROLLADOR
a. Ir a la herramienta Visual Basic

PROCEDIMIENTO DE CREAR MDULO


6.

Ir al comando de Insertar
a. Y seleccionar el comando Mdulo

b. Cambiar la siguiente informacin

c. En la ventana que est a la derecha escribir el siguiente cdigo que est en rojo
Option Explicit

Public Sub iniciar_Captura()


Load usfDirectorio
usfDirectorio.Show
End Sub

PROCEDIMIENTO CREAR FORMULARIO


7.

Ir al comando de Insertar
a. Y seleccionar el comando UserForms

b.

Cambiar las siguientes propiedades


i. (Name): UsfDirectorio
ii. Caption: Directorio Telefnico
iii. Height: 400

iv. Picture:
imagen
v. Width: 400

8.

ir a la carpeta de SESION 3 EXCEL, grecas3 y seleccionar una

Dar clic en el comando Cuadro de herramientas

a. Seleccionar el control Etiqueta y configurar las siguientes propiedades:

9.

i. BackStyle: 0 - fmBaackStyleTransparent
ii. Caption: Apellido y Nombre:
iii. Font:
1. Fuente: Book Antiqua
2. Estilo de fuente: Negrita
3. Tamao: 14
iv. ForeColor:
b. Seleccionar la etiqueta anterior Copiar y pegar
i. Caption: Correo Electrnico:
c. Seleccionar la etiqueta anterior Copiar y pegar
i. Caption: Telfono:
d. Seleccionar la etiqueta anterior Copiar y pegar
i. Caption: Celular:
e. Seleccionar la etiqueta anterior Copiar y pegar
i. Caption: Facebook:
f. Seleccionar la etiqueta anterior Copiar y pegar
i. Caption: Direccin:
Seleccionar el Control Cuadro de Texto y configurar las siguientes propiedades:

10.

i. (Name): txtApellidoNombre
ii. Font:
1. Fuente: Book Antiqua
2. Estilo de fuente: Negrita
3. Tamao: 14
iii. ForeColor: Negro
b. Seleccionar el cuadro de texto anterior Copiar y pegar
i. (Name): txtCorreoElectronico
c. Seleccionar el cuadro de texto anterior Copiar y pegar
i. (Name): txtTelefono
d. Seleccionar el cuadro de texto anterior Copiar y pegar
i. (Name): txtCelular
e. Seleccionar el cuadro de texto anterior Copiar y pegar
i. (Name): txtFacebook
f. Seleccionar el cuadro de texto anterior Copiar y pegar
i. (Name): txtDireccion
Seleccionar el Control Botn de Comando y configurar las siguientes propiedades:

i.
ii.
iii.
iv.

11.

(Name): cmdConsulta
BackColor: Azul
Caption: CONSULTA
Font:
1. Fuente: Centaur
2. Estilo de fuente: Negrita
3. Tamao: 16
v. ForeColor: Negro
b. Seleccionar el botn de comando anterior Copiar y pegar
i. (Name): cmdInsertar
ii. Caption: INSERTAR
c. Seleccionar el botn de comando anterior Copiar y pegar
i. (Name): cmdBajas
ii. Caption: BAJAS
d. Seleccionar el botn de comando anterior Copiar y pegar
i. (Name): cmdModificaciones
ii. Caption: MODIFICACIONES
e. Seleccionar el botn de comando anterior Copiar y pegar
i. (Name): cmdBorrar
ii. Caption: BORRAR
f. Seleccionar el botn de comando anterior Copiar y pegar
i. (Name): cmdSalir
ii. Caption: SALIR
Dar doble clic sobre el botn CONSULTA y copiar y pegar el siguiente cdigo que est en
rojo:

Dim ApNom As String


Dim idBusca As String
Dim fila As Integer
Application.ScreenUpdating = False
Sheets("BASE DE DATOS").Select
fila = 6
ApNom = txtApellidoNombre
Do While idBusca <> ApNom
fila = fila + 1
idBusca = Range("B" & fila).Value
If idBusca = Empty Then
Sheets("DIRECTORIO").Select
MsgBox "No se encontraron datos"
Exit Do

End If
Loop
txtCorreoElectronico = Range("C" & fila).Value
txtTelefono = Range("D" & fila).Value
txtCelular = Range("E" & fila).Value
txtFacebook = Range("F" & fila).Value
txtDireccion = Range("G" & fila).Value

DIRECTORIO.Activate
Me.txtApellidoNombre.SetFocus
12.

Dar doble clic en usfDirectorio

13.

Dar doble clic sobre el botn INSERTAR y copiar y pegar el siguiente cdigo que est en
rojo:

If Me.txtApellidoNombre.Text = "" Then MsgBox ("Apellido y Nombre no puede estar vacio"): Exit Sub
If Me.txtCorreoElectronico.Text = "" Then MsgBox ("Correo Electronico no puede estar vacio"): Exit
Sub
If Me.txtTelefono.Text = "" Then MsgBox ("Telefono no puede estar vacio"): Exit Sub
If Me.txtCelular.Text = "" Then MsgBox ("Celular no puede estar vacio"): Exit Sub
If Me.txtFacebook.Text = "" Then MsgBox ("Facebook no puede estar vacio"): Exit Sub
If Me.txtDireccion.Text = "" Then MsgBox ("Direccion no puede estar vacio"): Exit Sub
If Sheets("BASE DE DATOS").Range("B7").Value = "" Then
Sheets("BASE DE DATOS").Range("B7").Value = Me.txtApellidoNombre.Text
Sheets("BASE DE DATOS").Range("C7").Value = Me.txtCorreoElectronico.Text
Sheets("BASE DE DATOS").Range("D7").Value = Me.txtTelefono.Text
Sheets("BASE DE DATOS").Range("E7").Value = Me.txtCelular.Text

Sheets("BASE DE DATOS").Range("F2").Value = Me.txtFacebook.Text


Sheets("BASE DE DATOS").Range("G2").Value = Me.txtDireccion.Text
Else
Sheets("BASE
DE
Me.txtApellidoNombre.Text

DATOS").Range("B7").End(xlDown)(xlDropDown).Value

Sheets("BASE DE DATOS").Range("B7").End(xlDown).Next.Value = Me.txtCorreoElectronico.Text


Sheets("BASE DE DATOS").Range("B7").End(xlDown).Next.Next.Value = Me.txtTelefono.Text
Sheets("BASE DE DATOS").Range("B7").End(xlDown).Next.Next.Next.Value = Me.txtCelular.Text
Sheets("BASE
DE
Me.txtFacebook.Text
Sheets("BASE
DE
Me.txtDireccion.Text

DATOS").Range("B7").End(xlDown).Next.Next.Next.Next.Value
DATOS").Range("B7").End(xlDown).Next.Next.Next.Next.Next.Value

Me.txtApellidoNombre.Text = ""
Me.txtCorreoElectronico.Text = ""
Me.txtTelefono.Text = ""
Me.txtCelular.Text = ""
Me.txtFacebook.Text = ""
Me.txtDireccion.Text = ""
Me.txtApellidoNombre.SetFocus
End If
14.

Dar doble clic en usfDirectorio

15.

Dar doble clic sobre el botn BAJAS y copiar y pegar el siguiente cdigo que est en rojo:

Dim ApNom As String


Dim idBusca As String

=
=

Dim fila As Integer


Application.ScreenUpdating = False
Sheets("BASE DE DATOS").Select
fila = 6
ApNom = txtApellidoNombre
Do While idBusca <> ApNom
fila = fila + 1
idBusca = Range("B" & fila).Value
If idBusca = Empty Then
Sheets("DIRECTORIO").Select
MsgBox "No se encontraron datos"
Exit Do
End If
Loop
Range("B" & fila).Select
Selection.EntireRow.Delete
Me.txtApellidoNombre.Text = ""
DIRECTORIO.Activate
16.

Dar doble clic en usfDirectorio

17.

Dar doble clic sobre el botn MODIFICACIONES y copiar y pegar el siguiente cdigo que
est en rojo:

Dim ApNom As String


Dim idBusca As String
Dim fila As Integer

Application.ScreenUpdating = False
Sheets("BASE DE DATOS").Select
fila = 6
ApNom = txtApellidoNombre
Do While idBusca <> ApNom
fila = fila + 1
idBusca = Range("B" & fila).Value
If idBusca = Empty Then
Sheets("DIRECTORIO").Select
MsgBox "No se encontraron datos"
Exit Do
End If
Loop
Range("C" & fila).Value = txtCorreoElectronico
Range("D" & fila).Value = txtTelefono
Range("E" & fila).Value = txtCelular
Range("F" & fila).Value = txtFacebook
Range("G" & fila).Value = txtDireccion
Me.txtApellidoNombre.Text = ""
Me.txtCorreoElectronico.Text = ""
Me.txtTelefono.Text = ""
Me.txtCelular.Text = ""
Me.txtFacebook.Text = ""
Me.txtDireccion.Text = ""
Me.txtApellidoNombre.SetFocus
18.

Dar doble clic en usfDirectorio

19.

Dar doble clic sobre el botn BORRAR y copiar y pegar el siguiente cdigo que est en
rojo:

Me.txtApellidoNombre.Text = ""
Me.txtCorreoElectronico.Text = ""
Me.txtTelefono.Text = ""
Me.txtCelular.Text = ""
Me.txtFacebook.Text = ""
Me.txtDireccion.Text = ""
Me.txtApellidoNombre.SetFocus
20.

Dar doble clic en usfDirectorio

21.

Dar doble clic sobre el botn SALIR y copiar y pegar el siguiente cdigo que est en rojo:

usfDirectorio.Hide

PROCEDIMIENTO DE INGRESAR AL FORMULARIO DESDE EL LIBRO


22.

Dar clic en el comando Salir del Editor Visual Basic

23.
24.

Escribir su nombre donde dice ESCRIBE TU NOMBRE AQU


Ir a la ficha DESARROLLADOR

a. Seleccionar el Control de Formulario Botn de comando, dibujar en la celda B7 y


configurar:

i. Seleccionar la macro iniciar_Captura


ii. Dar clic en el botn Aceptar

b. Clic derecho sobre el botn, Modificar Texto y escribir DIRECTORIO


c. Seleccionar la palabra DIRECTORIO, dar clic en la ficha INICIO y configurar:
i. Fuente: Bell MT
ii. Tamao: 18
PROCEDIMIENTO PARA GUARDAR UN LIBRO CON MACROS

25.

Ir a la ficha ARCHIVO
a. Guardar como
b. Examinar
c. Ir a la ubicacin donde deseas guardar tu trabajo y configurar:
d. Nombre: Formulario+sunombre
e. Tipo: Libro de Excel Habilitado para Macros
f. Clic en el botn Guardar

You might also like