SlideShare una empresa de Scribd logo
1 de 6
OptionExplicit
DimArchivoIMG AsString
Private Subcmd_Agregar_Click()
Dim i As Integer
If cbo_Nombre.Text="" Then
MsgBox "Nombre inválido",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
ExitSub
End If
If Not(Mid(cbo_Nombre.Text,1,1) Like "[a-z]"OrMid(cbo_Nombre.Text,1,1) Like "[A-Z]")
Then
MsgBox "Nombre inválido",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
ExitSub
End If
For i = 2 To Len(cbo_Nombre.Text)
If Mid(cbo_Nombre.Text,i,1) Like "#"Then
MsgBox "Nombre inválido",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
ExitSub
EndIf
Next
Sheets("Clientes").Activate
Dim fClienteAs Integer
fCliente =nCliente(cbo_Nombre.Text)
If fCliente=0 Then
Do While NotIsEmpty(ActiveCell)
ActiveCell.Offset(1,0).Activate 'si el registronoexiste,se vaal final.
Loop
Else
Cells(fCliente,1).Select 'cuando ya existe el registro,cumple estacondición.
End If
'Aqui escuando agregamoso modificamosel registro
Application.ScreenUpdating=False
ActiveCell=cbo_Nombre
ActiveCell.Offset(0,1) = txt_Direccion
ActiveCell.Offset(0,2) = txt_Telefono
ActiveCell.Offset(0,3) = txt_ID
ActiveCell.Offset(0,4) = txt_Email
ActiveCell.Offset(0,5) = ArchivoIMG
Application.ScreenUpdating=True
LimpiarFormulario
cbo_Nombre.SetFocus
End Sub
Private Subcmd_Eliminar_Click()
Dim fClienteAsInteger
fCliente =nCliente(cbo_Nombre.Text)
If fCliente=0 Then
MsgBox "El cliente que ustedquiere eliminarnoexiste",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
ExitSub
End If
If MsgBox("¿Seguroque quiere eliminareste cliente?",vbQuestion+vbYesNo) =vbYesThen
Cells(fCliente,1).Select
ActiveCell.EntireRow.Delete
LimpiarFormulario
MsgBox "Cliente eliminado",vbInformation+vbOKOnly
cbo_Nombre.SetFocus
End If
End Sub
Private Subcmd_Cerrar_Click()
End
End Sub
Private Subcbo_Nombre_Change()
On Error Resume Next
If nCliente(cbo_Nombre.Text) <>0 Then
Sheets("Clientes").Activate
Cells(cbo_Nombre.ListIndex +2, 1).Select
txt_Direccion=ActiveCell.Offset(0,1)
txt_Telefono=ActiveCell.Offset(0,2)
txt_ID= ActiveCell.Offset(0,3)
txt_Email = ActiveCell.Offset(0,4)
fotografia.Picture =LoadPicture("")
fotografia.Picture =LoadPicture(ActiveCell.Offset(0,5))
ArchivoIMG= ActiveCell.Offset(0,5)
Else
txt_Direccion=""
txt_Telefono=""
txt_ID= ""
txt_Email = ""
ArchivoIMG= ""
fotografia.Picture =LoadPicture("")
End If
End Sub
Private Subcbo_Nombre_Enter()
CargarLista
End Sub
SubCargarLista()
cbo_Nombre.Clear
Sheets("Clientes").Select
Range("A2").Select
Do While NotIsEmpty(ActiveCell)
cbo_Nombre.AddItemActiveCell.Value
ActiveCell.Offset(1,0).Select
Loop
End Sub
SubLimpiarFormulario()
CargarLista
cbo_Nombre = ""
txt_Direccion= ""
txt_Telefono=""
txt_ID = ""
txt_Email = ""
ArchivoIMG= ""
End Sub
Private Subcmd_Imagen_Click()
On Error Resume Next
ArchivoIMG= Application.GetOpenFilename("Imágenesjpg,*.jpg,Imágenesbmp,*.bmp",0,
"SeleccionarImágenparaReegistrode Clientes")
fotografia.Picture =LoadPicture("")
fotografia.Picture =LoadPicture(ArchivoIMG)
End Sub

Más contenido relacionado

Destacado

Tema 7-los-generos-literarios
Tema 7-los-generos-literariosTema 7-los-generos-literarios
Tema 7-los-generos-literariosBrenda Hdz
 
Millennials Will Inherit the Industry
Millennials Will Inherit the IndustryMillennials Will Inherit the Industry
Millennials Will Inherit the IndustryFathomllc
 
Spring tour 2016 Retirees
Spring tour 2016 RetireesSpring tour 2016 Retirees
Spring tour 2016 Retireescdupler
 
Moneyweb Investment Seminars - Peter Major
Moneyweb Investment Seminars - Peter MajorMoneyweb Investment Seminars - Peter Major
Moneyweb Investment Seminars - Peter Majormoneyweb
 
2013.10.30 건축과 기술 포럼 - 현실에서 가상으로, 뉴미디어의 공간 확장
2013.10.30 건축과 기술 포럼 - 현실에서 가상으로, 뉴미디어의 공간 확장2013.10.30 건축과 기술 포럼 - 현실에서 가상으로, 뉴미디어의 공간 확장
2013.10.30 건축과 기술 포럼 - 현실에서 가상으로, 뉴미디어의 공간 확장Kiheon Shin
 
Using Social Media to Connect Younger Customers
Using Social Media to Connect Younger CustomersUsing Social Media to Connect Younger Customers
Using Social Media to Connect Younger CustomersHall Internet Marketing
 
2011 Year End Tax Guide
2011 Year End Tax Guide2011 Year End Tax Guide
2011 Year End Tax Guidepquimby
 
Rayjay Ambekar on valuations, asset allocation and markets
Rayjay Ambekar on valuations, asset allocation and marketsRayjay Ambekar on valuations, asset allocation and markets
Rayjay Ambekar on valuations, asset allocation and marketsmoneyweb
 
MAS Social Media 7: Crowdsourcing
MAS Social Media 7: CrowdsourcingMAS Social Media 7: Crowdsourcing
MAS Social Media 7: CrowdsourcingMarci Ikeler
 
有機清潔您的家
有機清潔您的家有機清潔您的家
有機清潔您的家EternalSpring
 
Makkers Manifestatie Co-Green
Makkers Manifestatie Co-Green Makkers Manifestatie Co-Green
Makkers Manifestatie Co-Green Syto Goslinga
 
Is Any of This Social Media Stuff Working?
Is Any of This Social Media Stuff Working?Is Any of This Social Media Stuff Working?
Is Any of This Social Media Stuff Working?Hall Internet Marketing
 
Vftb character and theme
Vftb character and themeVftb character and theme
Vftb character and themekrowland
 
NKU Spring 2009 Undergraduate Commencement
NKU Spring 2009 Undergraduate CommencementNKU Spring 2009 Undergraduate Commencement
NKU Spring 2009 Undergraduate CommencementBreanna Gaddie
 

Destacado (20)

Tema 7-los-generos-literarios
Tema 7-los-generos-literariosTema 7-los-generos-literarios
Tema 7-los-generos-literarios
 
Evaluation - Q.2
Evaluation - Q.2Evaluation - Q.2
Evaluation - Q.2
 
Millennials Will Inherit the Industry
Millennials Will Inherit the IndustryMillennials Will Inherit the Industry
Millennials Will Inherit the Industry
 
лфк
лфклфк
лфк
 
The Power of Many: Coalitions for Policy Change
The Power of Many: Coalitions for Policy ChangeThe Power of Many: Coalitions for Policy Change
The Power of Many: Coalitions for Policy Change
 
Spring tour 2016 Retirees
Spring tour 2016 RetireesSpring tour 2016 Retirees
Spring tour 2016 Retirees
 
Moneyweb Investment Seminars - Peter Major
Moneyweb Investment Seminars - Peter MajorMoneyweb Investment Seminars - Peter Major
Moneyweb Investment Seminars - Peter Major
 
2013.10.30 건축과 기술 포럼 - 현실에서 가상으로, 뉴미디어의 공간 확장
2013.10.30 건축과 기술 포럼 - 현실에서 가상으로, 뉴미디어의 공간 확장2013.10.30 건축과 기술 포럼 - 현실에서 가상으로, 뉴미디어의 공간 확장
2013.10.30 건축과 기술 포럼 - 현실에서 가상으로, 뉴미디어의 공간 확장
 
Using Social Media to Connect Younger Customers
Using Social Media to Connect Younger CustomersUsing Social Media to Connect Younger Customers
Using Social Media to Connect Younger Customers
 
2011 Year End Tax Guide
2011 Year End Tax Guide2011 Year End Tax Guide
2011 Year End Tax Guide
 
Rayjay Ambekar on valuations, asset allocation and markets
Rayjay Ambekar on valuations, asset allocation and marketsRayjay Ambekar on valuations, asset allocation and markets
Rayjay Ambekar on valuations, asset allocation and markets
 
MAS Social Media 7: Crowdsourcing
MAS Social Media 7: CrowdsourcingMAS Social Media 7: Crowdsourcing
MAS Social Media 7: Crowdsourcing
 
有機清潔您的家
有機清潔您的家有機清潔您的家
有機清潔您的家
 
Makkers Manifestatie Co-Green
Makkers Manifestatie Co-Green Makkers Manifestatie Co-Green
Makkers Manifestatie Co-Green
 
Is Any of This Social Media Stuff Working?
Is Any of This Social Media Stuff Working?Is Any of This Social Media Stuff Working?
Is Any of This Social Media Stuff Working?
 
BPLogix it!
BPLogix it! BPLogix it!
BPLogix it!
 
Vftb character and theme
Vftb character and themeVftb character and theme
Vftb character and theme
 
Email Marketing for Your Business
Email Marketing for Your BusinessEmail Marketing for Your Business
Email Marketing for Your Business
 
NKU Spring 2009 Undergraduate Commencement
NKU Spring 2009 Undergraduate CommencementNKU Spring 2009 Undergraduate Commencement
NKU Spring 2009 Undergraduate Commencement
 
Real Time
Real TimeReal Time
Real Time
 

Último

Modelado de Casos de uso del negocio
Modelado de  Casos  de  uso  del negocioModelado de  Casos  de  uso  del negocio
Modelado de Casos de uso del negocioMagemyl Egana
 
CIBERSEGURIDAD Y SEGURIDAD INFORMÁTICA.pptx
CIBERSEGURIDAD  Y SEGURIDAD INFORMÁTICA.pptxCIBERSEGURIDAD  Y SEGURIDAD INFORMÁTICA.pptx
CIBERSEGURIDAD Y SEGURIDAD INFORMÁTICA.pptxalzabenjaminci00
 
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...juanforero141
 
El necesario mal del Legacy Code (Drupal Iberia 2024)
El necesario mal del Legacy Code (Drupal Iberia 2024)El necesario mal del Legacy Code (Drupal Iberia 2024)
El necesario mal del Legacy Code (Drupal Iberia 2024)Samuel Solís Fuentes
 
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptxTECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptxUPSE
 
contabilidad para la inflacion, contabilidad superior
contabilidad para la inflacion, contabilidad superiorcontabilidad para la inflacion, contabilidad superior
contabilidad para la inflacion, contabilidad superiorDalia Rodriguez
 
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdfTECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdfUPSE
 
Tipos de datos en Microsoft Access definiciones.pdf
Tipos de datos en Microsoft Access definiciones.pdfTipos de datos en Microsoft Access definiciones.pdf
Tipos de datos en Microsoft Access definiciones.pdfCarlosSanchez452245
 
Especificación casos de uso del negocio
Especificación  casos de uso del negocioEspecificación  casos de uso del negocio
Especificación casos de uso del negocioMagemyl Egana
 
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptxCiberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptxcorreafrancoci00
 

Último (10)

Modelado de Casos de uso del negocio
Modelado de  Casos  de  uso  del negocioModelado de  Casos  de  uso  del negocio
Modelado de Casos de uso del negocio
 
CIBERSEGURIDAD Y SEGURIDAD INFORMÁTICA.pptx
CIBERSEGURIDAD  Y SEGURIDAD INFORMÁTICA.pptxCIBERSEGURIDAD  Y SEGURIDAD INFORMÁTICA.pptx
CIBERSEGURIDAD Y SEGURIDAD INFORMÁTICA.pptx
 
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
serenidad APP presentacion.pdfes una innovadora aplicación móvil diseñada par...
 
El necesario mal del Legacy Code (Drupal Iberia 2024)
El necesario mal del Legacy Code (Drupal Iberia 2024)El necesario mal del Legacy Code (Drupal Iberia 2024)
El necesario mal del Legacy Code (Drupal Iberia 2024)
 
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptxTECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
TECNOLOGIA DE LA INFORMACION Y MULTIMEDIA 15 MAYO.pptx
 
contabilidad para la inflacion, contabilidad superior
contabilidad para la inflacion, contabilidad superiorcontabilidad para la inflacion, contabilidad superior
contabilidad para la inflacion, contabilidad superior
 
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdfTECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
TECNOLOGÍA DE LA INFORMACIÓN SLIDESHARE INVESTIGACION.pdf
 
Tipos de datos en Microsoft Access definiciones.pdf
Tipos de datos en Microsoft Access definiciones.pdfTipos de datos en Microsoft Access definiciones.pdf
Tipos de datos en Microsoft Access definiciones.pdf
 
Especificación casos de uso del negocio
Especificación  casos de uso del negocioEspecificación  casos de uso del negocio
Especificación casos de uso del negocio
 
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptxCiberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
Ciberseguridad y Seguridad Informática Franco Correa Grupo B.pptx
 

Option explicit

  • 1. OptionExplicit DimArchivoIMG AsString Private Subcmd_Agregar_Click() Dim i As Integer If cbo_Nombre.Text="" Then MsgBox "Nombre inválido",vbInformation+vbOKOnly cbo_Nombre.SetFocus ExitSub End If If Not(Mid(cbo_Nombre.Text,1,1) Like "[a-z]"OrMid(cbo_Nombre.Text,1,1) Like "[A-Z]") Then MsgBox "Nombre inválido",vbInformation+vbOKOnly cbo_Nombre.SetFocus ExitSub End If For i = 2 To Len(cbo_Nombre.Text) If Mid(cbo_Nombre.Text,i,1) Like "#"Then MsgBox "Nombre inválido",vbInformation+vbOKOnly cbo_Nombre.SetFocus ExitSub EndIf Next
  • 2. Sheets("Clientes").Activate Dim fClienteAs Integer fCliente =nCliente(cbo_Nombre.Text) If fCliente=0 Then Do While NotIsEmpty(ActiveCell) ActiveCell.Offset(1,0).Activate 'si el registronoexiste,se vaal final. Loop Else Cells(fCliente,1).Select 'cuando ya existe el registro,cumple estacondición. End If 'Aqui escuando agregamoso modificamosel registro Application.ScreenUpdating=False ActiveCell=cbo_Nombre ActiveCell.Offset(0,1) = txt_Direccion ActiveCell.Offset(0,2) = txt_Telefono ActiveCell.Offset(0,3) = txt_ID ActiveCell.Offset(0,4) = txt_Email ActiveCell.Offset(0,5) = ArchivoIMG
  • 3. Application.ScreenUpdating=True LimpiarFormulario cbo_Nombre.SetFocus End Sub Private Subcmd_Eliminar_Click() Dim fClienteAsInteger fCliente =nCliente(cbo_Nombre.Text) If fCliente=0 Then MsgBox "El cliente que ustedquiere eliminarnoexiste",vbInformation+vbOKOnly cbo_Nombre.SetFocus ExitSub End If If MsgBox("¿Seguroque quiere eliminareste cliente?",vbQuestion+vbYesNo) =vbYesThen Cells(fCliente,1).Select ActiveCell.EntireRow.Delete LimpiarFormulario
  • 4. MsgBox "Cliente eliminado",vbInformation+vbOKOnly cbo_Nombre.SetFocus End If End Sub Private Subcmd_Cerrar_Click() End End Sub Private Subcbo_Nombre_Change() On Error Resume Next If nCliente(cbo_Nombre.Text) <>0 Then Sheets("Clientes").Activate Cells(cbo_Nombre.ListIndex +2, 1).Select txt_Direccion=ActiveCell.Offset(0,1) txt_Telefono=ActiveCell.Offset(0,2) txt_ID= ActiveCell.Offset(0,3) txt_Email = ActiveCell.Offset(0,4) fotografia.Picture =LoadPicture("") fotografia.Picture =LoadPicture(ActiveCell.Offset(0,5))
  • 5. ArchivoIMG= ActiveCell.Offset(0,5) Else txt_Direccion="" txt_Telefono="" txt_ID= "" txt_Email = "" ArchivoIMG= "" fotografia.Picture =LoadPicture("") End If End Sub Private Subcbo_Nombre_Enter() CargarLista End Sub SubCargarLista() cbo_Nombre.Clear Sheets("Clientes").Select Range("A2").Select Do While NotIsEmpty(ActiveCell) cbo_Nombre.AddItemActiveCell.Value ActiveCell.Offset(1,0).Select Loop End Sub
  • 6. SubLimpiarFormulario() CargarLista cbo_Nombre = "" txt_Direccion= "" txt_Telefono="" txt_ID = "" txt_Email = "" ArchivoIMG= "" End Sub Private Subcmd_Imagen_Click() On Error Resume Next ArchivoIMG= Application.GetOpenFilename("Imágenesjpg,*.jpg,Imágenesbmp,*.bmp",0, "SeleccionarImágenparaReegistrode Clientes") fotografia.Picture =LoadPicture("") fotografia.Picture =LoadPicture(ArchivoIMG) End Sub