none
Mensagem de erro no excel 2007 RRS feed

  • Pergunta

  • Boa noite

    Ao executar a macro abaixo no Excel 2007 retona uma mensagem de erro conforme figura anexo.

    o que seria essa mensagem e como corrigir ?

    Obs.: Foi testado em outro PC funcionou normal.

    Sub Relatorio() Dim L, mes, nomedoarq As String nomedoarq = Plan3.Range("AA14").Value '"C:\Users\jn\Desktop\Relatorio Diario.docm" On Error GoTo ARQNE Plan7.Unprotect Password:="123" Application.ScreenUpdating = False Range("A1:AH1500").Select Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Range("A1:AH1500").Select Selection.Sort Key1:=Range("D2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Columns("H:I").Select Selection.EntireColumn.Hidden = True Columns("N:N").Select Selection.EntireColumn.Hidden = True Columns("AE:AF").Select Selection.EntireColumn.Hidden = True lin = Plan7.Range("B100").End(xlUp).Row Plan7.Range("A2:AG" & lin - 1).Select Selection.Copy Dim winWord As Object Dim wordDoc As Object Set winWord = CreateObject("Word.Application") winWord.Visible = True Set wordDoc = winWord.Documents.Open(nomedoarq) Columns("H:I").Select Selection.EntireColumn.Hidden = False Columns("N:N").Select Selection.EntireColumn.Hidden = False Columns("AE:AF").Select Selection.EntireColumn.Hidden = False Range("A1:AH1500").Select Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Range("A1:AH1500").Select Selection.Sort Key1:=Range("R2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom ActiveWindow.DisplayHeadings = False Range("a2").Select Plan7.Protect Password:="HGESF" Plan5.Activate Application.ScreenUpdating = True ThisWorkbook.Save Application.DisplayAlerts = False Application.Quit Exit Sub ARQNE: Columns("H:I").Select Selection.EntireColumn.Hidden = False Columns("N:N").Select Selection.EntireColumn.Hidden = False Columns("AE:AF").Select Selection.EntireColumn.Hidden = False Range("A1:AH1500").Select Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom Range("A1:AH1500").Select Selection.Sort Key1:=Range("R2"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom ActiveWindow.DisplayHeadings = False Range("a2").Select Plan7.Protect Password:="123" Plan5.Activate Set w = GetObject(, "Word.Application") w.Quit MsgBox "Arquivo não Encontrado!!" Agenda.Show Application.ScreenUpdating = True End Sub

    macro no arquivo Word

    Private Sub Document_Open()
     On Error Resume Next
     Application.ScreenUpdating = False
     Dim Intervalo As Range
     If Tables.Count > 0 Then
      Tables(1).Delete
     End If
     Selection.PasteExcelTable False, False, False
     
     Selection.WholeStory
     Selection.Rows.HeightRule = wdRowHeightAtLeast
     Selection.Rows.Height = CentimetersToPoints(0.03)
     Selection.ParagraphFormat.SpaceBefore = 6

     ActiveDocument.Tables(1).Columns(2).Select
     Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft

     Selection.MoveDown Unit:=wdLine, Count:=1
     Application.ScreenUpdating = True
    End Sub

    Obrigado a todos.


    • Editado JLNunes quarta-feira, 28 de janeiro de 2015 00:50
    quarta-feira, 28 de janeiro de 2015 00:42