Esta es la otra parte la Macro
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Application.Intersect(Target, Range("B11:B20")) Is Nothing Then
Cancel = True
frm_Cliente.Show
Else
End If
If Not Intersect(Target, Range("D11:D20")) Is Nothing Then
frm_Proveedor.Show
Else
End If
End Sub
Sub FormulaRango()
ActiveSheet.Unprotect "Fulcrum07"
Hoja1.Range("E11:E20").Formula = "=IFERROR(VLOOKUP(D11,Proveedores!$A$2:$B$34,2,FALSE),"""")"
ActiveSheet.Protect "Fulcrum07"
End Sub
Sub Enviar()
nombre = Cells(7, 3).Value
folio = Cells(5, 12).Value
fecha = Cells(7, 12).Value
mes = Format(Date, "mmmm")
año = Year(Date)
ruta = "K:\Ordenes de Compra\EXPOSICION\"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ruta & nombre & "" & folio, Quality:= _
xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Application.DisplayAlerts = False
ActiveSheet.Unprotect "Fulcrum07"
Range("L5").Value = Range("L5").Value + 1
Range("B11:D11,B12:D12,B13:D13,B14:D14,B15:D15,B16:D16,B17:D17,B18:D18,B19:D19,B20:D20,F11:I11,F12:I12,F13:I13,F14:I14,F15:I15,F16:I16,F17:I17,F18:I18,F19:I19,F20:I20,C24:N24,B25:N25,B26:N26,B27:N27,L11:L20,J11:J12").ClearContents
ActiveSheet.Protect "Fulcrum07"
ActiveWorkbook.Save
strReportName = "K:\Ordenes de Compra\EXPOSICION\OrdendeCompra_Jorge Suarez.xlsm"
Dim objOutlook As Object
Dim objMail As Object
Dim objOutlookAttach As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(olMailItem)
Set objOutlookAttach = objOutlook.CreateItem(olAttachMents)
With objMail
'A quien va dirigido el correo
.to = ""
.CC = ""
.BCC = ""
'Se especifica el asunto
.Subject = " O.C. De " & fecha & nombre & folio
'Se escriben el o los archivos a adjuntar en el mail
On Error Resume Next
.Attachments.Add ruta & nombre & " " & folio & " .pdf"
.Body = "Se anexa orden de compra favor de confirmar recepción"
'Se manda el mensaje
.Send
End With
'Se cierran todos los objetos utilizados
Set objMail = Nothing
Set objOutlook = Nothing
ActiveWorkbook.Close
End Sub