Ir ao conteúdo
  • Cadastre-se

BRUNO_H_S_L

Membro Júnior
  • Posts

    3
  • Cadastrado em

  • Última visita

Reputação

0
  1. Sem problemas... Agora com mais calma e depois de passar o dia todo tentando fazer isso funcionar consegui incluir no Userform com sucesso! Segue o código final para ajudar futuros viajantes! Private Sub CommandButton_cadastrar_Click() Range("a10000").Select If Range("a10001").Value <> "" Then Selection.End(xlDown).Select End If ActiveCell.Offset(1, 0).Select Selection.Value = TextBox_solicitante ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_Origem ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_Destino ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_Data ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_Horaenvio ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_tempolimite ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_itens ActiveCell.Offset(0, 1).Select ActiveWorkbook.RefreshAll Unload UserForm_cadastro 'Objeto de tabela dinâmica Dim pivotTable As pivotTable 'Loop por todos os objetos da planilha For Each plan In ActiveWorkbook.Sheets For Each pivotTable In plan.PivotTables pivotTable.RefreshTable Next Next Dim olApp As Outlook.Application Dim olApt As AppointmentItem Set olApp = New Outlook.Application 'Creating Outlook Session Set olApt = olApp.CreateItem(olAppointmentItem) 'Creating an Appointment linha = ActiveCell.Row If Planilha3.Cells(linha, 5) >= 1 Then texto = "Solicitante: " & Planilha3.Cells(linha, 1) & vbCrLf & "Origem: " & Planilha3.Cells(linha, 2) & vbCrLf & "Destino: " & Planilha3.Cells(linha, 3) & vbCrLf & "Data de inclusão: " & Planilha3.Cells(linha, 4) & vbCrLf End If With olApt .Subject = Planilha3.Cells(linha, 21) 'Subject .Start = DateAdd("D", 1, Now) 'Enter Date + Time here. .Recipients.Add ("[email protected]") 'Recipient Name, Alias, or any other Attribute. .MeetingStatus = olMeeting 'olAppointmentItem with Meeting status olMeeting 'becomes a OL Meeting Item. .Duration = 30 'In Minutes .Body = "O referido Card está vencendo! É necessário verificar se recebeu tratativa: " & vbCrLf & vbCrLf & "Solicitante: " & Planilha3.Cells(linha, 1) & vbCrLf & "Origem: " & Planilha3.Cells(linha, 2) & vbCrLf & "Destino: " & Planilha3.Cells(linha, 3) & vbCrLf & "Data de inclusão: " & Planilha3.Cells(linha, 4) & vbCrLf 'Body .Location = "PLANILHA KAMBAN" 'Location of the meeting. .Display 'for Displaying olMeeting window. End With Application.Wait DateAdd("s", 2, Now) 'waiting for 2 sec to let OL window to display. SendKeys "%s", True 'Sending Mail. Set olApt = Nothing MsgBox "Lembrete Enviado ao Outlook com sucesso!", vbInformation End Sub adicionado 1 minuto depois Uma última dúvida, Teria como eu incluir uma data calculada em uma célula aqui no lugar do "1"? Ou melhor, data e hora? .Start = DateAdd("D", 1, Now)
  2. Não consegui, Meu userform "cadastrar" esta desta forma: Private Sub CommandButton_cadastrar_Click() Range("a10000").Select If Range("a10001").Value <> "" Then Selection.End(xlDown).Select End If ActiveCell.Offset(1, 0).Select Selection.Value = TextBox_solicitante ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_Origem ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_Destino ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_Data ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_Horaenvio ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_tempolimite ActiveCell.Offset(0, 1).Select Selection.Value = TextBox_itens ActiveCell.Offset(0, 1).Select ActiveWorkbook.RefreshAll Unload UserForm_cadastro 'Objeto de tabela dinâmica Dim pivotTable As pivotTable 'a parte a seguir atualiza todas as tabelas dinâmicas For Each plan In ActiveWorkbook.Sheets For Each pivotTable In plan.PivotTables pivotTable.RefreshTable Next Next End Sub
  3. Amigos, Estou com problema nesse código. a principio, no momento em que uma célula receber uma informação na coluna "E" deve-se gerar uma reunião no Outlook. O código esta rodando perfeitamente desde que eu inclua manualmente essa informação. O problema é que sessa informação vem através de uma Userform e ao ser inserida o Worksheet_change não reconhece. Tenho que clicar na célula como se fosse edita-la e dar Enter. Tentei usar o Evento Calculate, que entra em conflito com o" If Target.Address = "$E$" & linha Then" e não da certo. Private Sub Worksheet_Change(ByVal Target As Range) Dim olApp As Outlook.Application Dim olApt As AppointmentItem Set olApp = New Outlook.Application 'Creating Outlook Session Set olApt = olApp.CreateItem(olAppointmentItem) 'Creating an Appointment linha = ActiveCell.Row - 1 If Target.Address = "$E$" & linha Then If Planilha3.Cells(linha, 5) >= 1 Then texto = "Solicitante: " & Planilha3.Cells(linha, 1) & vbCrLf & "Origem: " & Planilha3.Cells(linha, 2) & vbCrLf & "Destino: " & Planilha3.Cells(linha, 3) & vbCrLf & "Data de inclusão: " & Planilha3.Cells(linha, 4) & vbCrLf End If With olApt .Subject = Planilha3.Cells(linha, 21) 'Subject .Start = DateAdd("D", 1, Now) 'Enter Date + Time here. .Recipients.Add ("[email protected]") 'Recipient Name, Alias, or any other Attribute. .MeetingStatus = olMeeting 'olAppointmentItem with Meeting status olMeeting 'becomes a OL Meeting Item. .Duration = 30 'In Minutes .Body = "O referido Card está vencendo! É necessário verificar se recebeu tratativa: " & vbCrLf & vbCrLf & "Solicitante: " & Planilha3.Cells(linha, 1) & vbCrLf & "Origem: " & Planilha3.Cells(linha, 2) & vbCrLf & "Destino: " & Planilha3.Cells(linha, 3) & vbCrLf & "Data de inclusão: " & Planilha3.Cells(linha, 4) & vbCrLf 'Body .Location = "planilha" 'Location of the meeting. .Display 'for Displaying olMeeting window. End With Application.Wait DateAdd("s", 2, Now) 'waiting for 2 sec to let OL window to display. SendKeys "%s", True 'Sending Mail. Set olApt = Nothing MsgBox "Lembrete Enviado ao Outlook com sucesso!", vbInformation End If End Sub

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...