Ir para conteúdo
Fórum Script Brasil

Humig

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Sobre Humig

Humig's Achievements

0

Reputação

  1. Humig

    Macro VBA Outlook

    Saudações a todos, Sou principiante em VBA e preciso programar um macro para "montar" um email com destinatario , assunto, etc., abrir este email e aguardar o usuario editar algo se necessario e clicar o botão enviar. Tbém preciso saber se o usuario realmente enviou o email. Para isso fiz o codigo abaixo, o problema é que se uso o metodo DISPLAY(.T.), a propriedade SENT aparentemente não é atualizada ! Sub toutlook() Dim oout As Application Dim omsg As MailItem Set oout = CreateObject("Outlook.Application") Set omsg = oout.CreateItem(olMailItem) omsg.To = "hucf@ig.com.br" omsg.Subject = "Teste Objeto Outlook no Macro Excel" omsg.Display (True) 'omsg.Send If omsg.Sent Then MsgBox (" Enviado ") Else MsgBox (" não Enviado ") End If Set oout = Nothing Set omsg = Nothing End Sub Agradeço qualquer ajuda, HU (Tentei inserir CODEBOX , mas da erro 404 ?)
  2. Humig

    Field em Table Cell

    Salve srs. , comecei com VBA ainda agora então basicamente estou "brincando" com o codigo para aprender ! Minha duvida : porque o codigo 1 abaixo funciona e o cod. 2 não ? As diferencas estão em negrito. O cod.2 retorna mensagem : "Run time error 4605" "Function is not available". Agradeço qualquer ajuda Hu Cod. 1 Dim odoc As Word.Document Dim otb1 As Table Dim otb2 As Table Dim opr1 As Paragraph Dim opr2 As Paragraph Dim opr3 As Paragraph Dim opr4 As Paragraph Dim opr5 As Paragraph Dim opr6 As Paragraph Dim rng1 As Range Dim rng2 As Range Dim rng3 As Range Dim rng4 As Range Dim rng5 As Range Dim rng6 As Range Dim crng1 As Range Dim srng As Range Dim osl1 As Selection Dim osl2 As Selection Dim csel As Selection Dim ofld As Field Set odoc = Word.Documents.Add 'odoc.PageSetup.Orientation = wdOrientLandscape odoc.PageSetup.TopMargin = CentimetersToPoints(2.5) odoc.PageSetup.BottomMargin = CentimetersToPoints(1.5) odoc.PageSetup.LeftMargin = CentimetersToPoints(2) odoc.PageSetup.RightMargin = CentimetersToPoints(2) odoc.PageSetup.Gutter = CentimetersToPoints(0) odoc.PageSetup.HeaderDistance = CentimetersToPoints(1) odoc.PageSetup.FooterDistance = CentimetersToPoints(1) Set opr1 = odoc.Paragraphs.Add Set rng1 = opr1.Range Set otb1 = odoc.Tables.Add(Range:=rng1, NumRows:=3, NumColumns:= _ 2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _ wdAutoFitFixed) otb1.Borders.OutsideLineStyle = wdLineStyleSingle 'otb1.Borders.InsideLineStyle = wdLineStyleNone otb1.Columns.Item(1).PreferredWidth = 350 otb1.Columns.Item(2).PreferredWidth = 100 otb1.Cell(1, 1).Range.Font.Name = "Kozuka Gothic Pro M" otb1.Cell(1, 1).Range.Font.Size = 12 otb1.Cell(1, 1).Range.InsertAfter (" LYC DO BRASIL ") Selection.MoveRight (wdCell) otb1.Cell(1, 2).Range.Font.Name = "Arial" otb1.Cell(1, 2).Range.Font.Size = 10 ''otb1.Cell(1, 2).Range.Select Set ofld = otb1.Cell(1, 2).Range.Fields.Add(Selection.Range, -1, "AUTOTEXT ""Página X de Y"" ", True) Cod. 2 Dim odoc As Word.Document Dim otb1 As Table Dim otb2 As Table Dim opr1 As Paragraph Dim opr2 As Paragraph Dim opr3 As Paragraph Dim opr4 As Paragraph Dim opr5 As Paragraph Dim opr6 As Paragraph Dim rng1 As Range Dim rng2 As Range Dim rng3 As Range Dim rng4 As Range Dim rng5 As Range Dim rng6 As Range Dim crng1 As Range Dim srng As Range Dim osl1 As Selection Dim osl2 As Selection Dim csel As Selection Dim ofld As Field Set odoc = Word.Documents.Add 'odoc.PageSetup.Orientation = wdOrientLandscape odoc.PageSetup.TopMargin = CentimetersToPoints(2.5) odoc.PageSetup.BottomMargin = CentimetersToPoints(1.5) odoc.PageSetup.LeftMargin = CentimetersToPoints(2) odoc.PageSetup.RightMargin = CentimetersToPoints(2) odoc.PageSetup.Gutter = CentimetersToPoints(0) odoc.PageSetup.HeaderDistance = CentimetersToPoints(1) odoc.PageSetup.FooterDistance = CentimetersToPoints(1) Set opr1 = odoc.Paragraphs.Add Set rng1 = opr1.Range Set otb1 = odoc.Tables.Add(Range:=rng1, NumRows:=3, NumColumns:= _ 2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _ wdAutoFitFixed) otb1.Borders.OutsideLineStyle = wdLineStyleSingle 'otb1.Borders.InsideLineStyle = wdLineStyleNone otb1.Columns.Item(1).PreferredWidth = 350 otb1.Columns.Item(2).PreferredWidth = 100 otb1.Cell(1, 1).Range.Font.Name = "Kozuka Gothic Pro M" otb1.Cell(1, 1).Range.Font.Size = 12 otb1.Cell(1, 1).Range.InsertAfter (" LYC DO BRASIL ") 'Selection.MoveRight (wdCell) otb1.Cell(1, 2).Range.Font.Name = "Arial" otb1.Cell(1, 2).Range.Font.Size = 10 otb1.Cell(1, 2).Range.Select Set ofld = otb1.Cell(1, 2).Range.Fields.Add(Selection.Range, -1, "AUTOTEXT ""Página X de Y"" ", True)
×
×
  • Criar Novo...