Adunare valori folosind vba

Ce este nou in Microsoft Word 2010?
Informatii despre cum se utilizeaza Microsoft Word 2010
Editare, formatare, automatizare de documente
Închis
ccirtina
Mesaje: 280
Membru din: Lun Oct 11, 2010 9:49 pm
Localitate: Craiova

Adunare valori folosind vba

Mesaj de ccirtina » Mie Iul 02, 2014 2:07 pm

Buna ziua,
Am cautat si am gasit ceva dar esste in excel si nu stiu cum sa transpun in VBA Word 2010(adunare conditionata)
Am un fisier cu un text(este atasat)
Caut in el textele cu urmatorul cod:

Cod: Selectaţi tot

Sub SedintaTotala()
Dim iCount As Long
Dim strSearch As String
Dim denTmp0 As String
Dim denTmp1 As String
Dim denTmp2 As String
Dim denTmp3 As String
Dim denTmp4 As String
Dim denTmp5 As String
Dim denTmp6 As String

Selection.HomeKey Unit:=wdStory
    strSearch = " SRL"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp0 = "Nr. SRL-uri = " & iCount
    Debug.Print denTmp0
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = " SNC"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp1 = "Nr. SNC-uri = " & iCount
    Debug.Print denTmp1
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = " SA"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp2 = "Nr. SA-uri = " & iCount
    Debug.Print denTmp2
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = " SCM"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp3 = "Nr. SCM-uri = " & iCount
    Debug.Print denTmp3
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = "COOPERATIVA AGRICOLA"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp4 = "Nr. COOPERATIVA AGRICOLA = " & iCount
    Debug.Print denTmp4
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = "PERSOAN"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp5 = "PERSOANA FIZICA AUTORIZATA = " & iCount
    Debug.Print denTmp5
Selection.HomeKey Unit:=wdStory
End If

''''''''''''''''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = "ÎNTREPRINDERE "
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp6 = "ÎNTREPRINDERE INDIVIDUALA + FAMILIALA = " & iCount
    Debug.Print denTmp6
Selection.EndKey Unit:=wdStory
End If



''''''''''''''''''''''''''''

'Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
   Selection.TypeText Text:=Chr(13) & Chr(13)
   If denTmp0 <> "Nr. SRL-uri = 0" Then
    Selection.TypeText Text:=denTmp0 & Chr(13)
    End If
    If denTmp1 <> "Nr. SNC-uri = 0" Then
    Selection.TypeText Text:=denTmp1 & Chr(13)
    End If
    If denTmp2 <> "Nr. SA-uri = 0" Then
    Selection.TypeText Text:=denTmp2 & Chr(13)
    End If
    If denTmp3 <> "Nr. SCM-uri = 0" Then
    Selection.TypeText Text:=denTmp3 & Chr(13)
    End If
    If denTmp4 <> "Nr. COOPERATIVA AGRICOLA = 0" Then
    Selection.TypeText Text:=denTmp4 & Chr(13)
    End If
    If denTmp5 <> "PERSOANA FIZICA AUTORIZATA = 0" Then
    Selection.TypeText Text:=denTmp5 & Chr(13)
    End If
    If denTmp6 <> "ÎNTREPRINDERE INDIVIDUALA + FAMILIALA = 0" Then
    Selection.TypeText Text:=denTmp6 & Chr(13)
    End If
    Selection.TypeText Text:=Chr(13) & "--------------------------" & Chr(13)
    Call TipCerere
End Sub


Function TipCerere()
Dim x, Response
Dim y As Integer
Dim denTmp0 As String
Dim denTmp1 As String
Dim denTmp2 As String
Dim denTmp3 As String
Dim denTmp4 As String
Dim denTmp5 As String
Dim denTmp6 As String
Dim denTmp7 As String
Dim denTmp8 As String
Dim denTmp9 As String
Dim denTmp10 As String
Dim denTmp11 As String
Dim denTmp12 As String
Dim denTmp13 As String
Dim denTmp14 As String
Dim denTmp15 As String
Dim denTmp16 As String
Dim denTmp17 As String
Dim denTmp18 As String
Dim denTmp19 As String
Dim denTmp20 As String
Dim denTmp21 As String
Dim denTmp22 As String
Dim denTmp23 As String
Dim denTmp24 As String
Dim denTmp25 As String
Dim denTmp26 As String
Dim denTmp27 As String
Dim denTmp28 As String
Dim denTmp29 As String
Dim denTmp30 As String
Dim denTmp31 As String
Dim denTmp32 As String
Dim denTmp33 As String
Dim denTmp34 As String
Dim denTmp35 As String
Dim denTmp36 As String



x = "Anulare rezervare"
y = 0
With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp0 = x & " = " & y
    Debug.Print denTmp0
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Anulare rezervare emblem" & ChrW(259)
y = 0
With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp1 = x & " = " & y
    Debug.Print denTmp1
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "CCFIL"
y = 0
With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp2 = x & " = " & y
    Debug.Print denTmp2
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere cale de atac"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp3 = x & " = " & y
    Debug.Print denTmp3
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de audien" & ChrW(355) & ChrW(259) & " public" & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp4 = x & " = " & y
    Debug.Print denTmp4
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de completare/retragere acte"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp5 = x & " = " & y
    Debug.Print denTmp5
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de depunere situatie financiar" & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp6 = x & " = " & y
    Debug.Print denTmp6
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de depunere-mentionare acte"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp7 = x & " = " & y
    Debug.Print denTmp7
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de eliberare duplicat"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp8 = x & " = " & y
    Debug.Print denTmp8
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de modificare termen de solu" & ChrW(355) & "ionare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp9 = x & " = " & y
    Debug.Print denTmp9
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de notific" & ChrW(259) & "ri activit" & ChrW(259) & ChrW(355) & "i la sedii"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp10 = x & " = " & y
    Debug.Print denTmp10
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de preschimbare certificate"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp11 = x & " = " & y
    Debug.Print denTmp11
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de renuntare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp12 = x & " = " & y
    Debug.Print denTmp12
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de servicii de asisten" & ChrW(355) & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp13 = x & " = " & y
    Debug.Print denTmp13
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere numire expert"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp14 = x & " = " & y
    Debug.Print denTmp14
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere verificare sedii"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp15 = x & " = " & y
    Debug.Print denTmp15
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Concordat preventive"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp16 = x & " = " & y
    Debug.Print denTmp16
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Eliberare informa" & ChrW(355) & "ii"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp17 = x & " = " & y
    Debug.Print denTmp17
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Eliberare inscrisuri bulk"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp18 = x & " = " & y
    Debug.Print denTmp18
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Eliberare înscrisuri"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp19 = x & " = " & y
    Debug.Print denTmp19
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Erori materiale"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp20 = x & " = " & y
    Debug.Print denTmp20
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Men" & ChrW(355) & "iune"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp21 = x & " = " & y
    Debug.Print denTmp21
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Men" & ChrW(355) & "iune de denominare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp22 = x & " = " & y
    Debug.Print denTmp22
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Nota interna"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp23 = x & " = " & y
    Debug.Print denTmp23
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Oficiu"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp24 = x & " = " & y
    Debug.Print denTmp24
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Prelungire rezervare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp25 = x & " = " & y
    Debug.Print denTmp25
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Prelungire rezervare emblem" & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp26 = x & " = " & y
    Debug.Print denTmp26
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Preschimbare obiecte de activitate"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp27 = x & " = " & y
    Debug.Print denTmp27
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Procedura de insolven" & ChrW(355) & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp28 = x & " = " & y
    Debug.Print denTmp28
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Prospecte de emisiuni"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp29 = x & " = " & y
    Debug.Print denTmp29
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Radiere firma"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp30 = x & " = " & y
    Debug.Print denTmp30
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Radiere men" & ChrW(355) & "iune"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp31 = x & " = " & y
    Debug.Print denTmp31
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Radierea unei radieri"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp32 = x & " = " & y
    Debug.Print denTmp32
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Rezervare Emblema"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp33 = x & " = " & y
    Debug.Print denTmp33
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Rezervare denumire"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp34 = x & " = " & y
    Debug.Print denTmp34
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Verificare unicitate asociat"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp35 = x & " = " & y
    Debug.Print denTmp35
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Înmatriculare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTmp36 = x & " = " & y
    Debug.Print denTmp0
Selection.EndKey Unit:=wdStory
''''''''''''''''''''
'If denTmp0 <> "Anulare rezervare = 0"  Then
'    Selection.TypeText Text:=denTmp0 & Chr(13)
'    End If
If denTmp1 <> "Anulare rezervare emblem" & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTmp1 & Chr(13)
    End If
If denTmp2 <> "CCFIL = 0" Then
    Selection.TypeText Text:=denTmp2 & Chr(13)
    End If
If denTmp3 <> "Cerere cale de atac = 0" Then
    Selection.TypeText Text:=denTmp3 & Chr(13)
    End If
If denTmp4 <> "Cerere de audien" & ChrW(355) & ChrW(259) & " public" & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTmp4 & Chr(13)
    End If
If denTmp5 <> "Cerere de completare/retragere acte = 0" Then
    Selection.TypeText Text:=denTmp5 & Chr(13)
    End If
If denTmp6 <> "Cerere de depunere situatie financiar" & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTmp6 & Chr(13)
    End If
If denTmp7 <> "Cerere de depunere-mentionare acte = 0" Then
    Selection.TypeText Text:=denTmp7 & Chr(13)
    End If
If denTmp8 <> "Cerere de eliberare duplicat = 0" Then
    Selection.TypeText Text:=denTmp8 & Chr(13)
    End If
If denTmp9 <> "Cerere de modificare termen de solu" & ChrW(355) & "ionare = 0" Then
    Selection.TypeText Text:=denTmp9 & Chr(13)
    End If
If denTmp10 <> "Cerere de notific" & ChrW(259) & "ri activit" & ChrW(259) & ChrW(355) & "i la sedii = 0" Then
    Selection.TypeText Text:=denTmp10 & Chr(13)
    End If
If denTmp11 <> "Cerere de preschimbare certificate = 0" Then
    Selection.TypeText Text:=denTmp11 & Chr(13)
    End If
If denTmp12 <> "Cerere de renuntare = 0" Then
    Selection.TypeText Text:=denTmp12 & Chr(13)
    End If
If denTmp13 <> "Cerere de servicii de asisten" & ChrW(355) & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTmp13 & Chr(13)
    End If
If denTmp14 <> "Cerere numire expert = 0" Then
    Selection.TypeText Text:=denTmp14 & Chr(13)
    End If
If denTmp15 <> "Cerere verificare sedii = 0" Then
    Selection.TypeText Text:=denTmp15 & Chr(13)
    End If
If denTmp16 <> "Concordat preventive = 0" Then
    Selection.TypeText Text:=denTmp16 & Chr(13)
    End If
If denTmp17 <> "Eliberare informa" & ChrW(355) & "ii = 0" Then
    Selection.TypeText Text:=denTmp17 & Chr(13)
    End If
If denTmp18 <> "Eliberare inscrisuri bulk = 0" Then
    Selection.TypeText Text:=denTmp18 & Chr(13)
    End If
If denTmp19 <> "Eliberare înscrisuri = 0" Then
    Selection.TypeText Text:=denTmp19 & Chr(13)
    End If
If denTmp20 <> "Erori materiale = 0" Then
    Selection.TypeText Text:=denTmp20 & Chr(13)
    End If
If denTmp21 <> "Men" & ChrW(355) & "iune = 0" Then
    Selection.TypeText Text:=denTmp21 & Chr(13)
    End If
'If denTmp22 <> "Men" & ChrW(355) & "iune de denominare = 0"  Then
'    Selection.TypeText Text:=denTmp22 & Chr(13)
'    End If
If denTmp23 <> "Nota interna = 0" Then
    Selection.TypeText Text:=denTmp23 & Chr(13)
    End If
If denTmp24 <> "Oficiu = 0" Then
    Selection.TypeText Text:=denTmp24 & Chr(13)
    End If
'If denTmp25 <> "Prelungire rezervare = 0"  Then
'    Selection.TypeText Text:=denTmp25 & Chr(13)
'    End If
If denTmp26 <> "Prelungire rezervare emblem" & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTmp26 & Chr(13)
    End If
If denTmp27 <> "Preschimbare obiecte de activitate = 0" Then
    Selection.TypeText Text:=denTmp27 & Chr(13)
    End If
If denTmp28 <> "Procedura de insolven" & ChrW(355) & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTmp28 & Chr(13)
    End If
If denTmp29 <> "Prospecte de emisiuni = 0" Then
    Selection.TypeText Text:=denTmp29 & Chr(13)
    End If
If denTmp30 <> "Radiere firma = 0" Then
    Selection.TypeText Text:=denTmp30 & Chr(13)
    End If
If denTmp31 <> "Radiere men" & ChrW(355) & "iune = 0" Then
    Selection.TypeText Text:=denTmp31 & Chr(13)
    End If
If denTmp32 <> "Radierea unei radieri = 0" Then
    Selection.TypeText Text:=denTmp32 & Chr(13)
    End If
If denTmp33 <> "Rezervare Emblema = 0" Then
    Selection.TypeText Text:=denTmp33 & Chr(13)
    End If
If denTmp34 <> "Rezervare denumire = 0" Then
    Selection.TypeText Text:=denTmp34 & Chr(13)
    End If
If denTmp35 <> "Verificare unicitate asociat = 0" Then
    Selection.TypeText Text:=denTmp35 & Chr(13)
    End If
If denTmp36 <> "Înmatriculare = 0" Then
    Selection.TypeText Text:=denTmp36 & Chr(13)
    End If
    
    Selection.TypeText Text:=Chr(13) & "--------------------------" & Chr(13)
End Function

care ma intereseaza si imi da urmatorul raspuns:

Nr. SRL-uri = 13
Nr. SA-uri = 6
Nr. SCM-uri = 10
Nr. COOPERATIVA AGRICOLA = 3
PERSOANA FIZICA AUTORIZATA = 2
ÎNTREPRINDERE INDIVIDUALA + FAMILIALA = 5

--------------------------
Procedura de insolvenţă = 2

--------------------------


Cum fac sa-mi afiseze totalul T1 compus din SRL+SA+SCM+Cooperativa Agricola - Procedura de insolvenţă
T1= 30
si un alt total T2 compus din:
persoana fizica +intreprindere individuala+familiala
T2=7
Va multumesc
Nu aveţi permisiunea de a vizualiza fişierele ataşate acestui mesaj.

ccirtina
Mesaje: 280
Membru din: Lun Oct 11, 2010 9:49 pm
Localitate: Craiova

Re: Adunare valori folosind vba

Mesaj de ccirtina » Vin Iul 04, 2014 9:19 am

Am rezolvat.
Trebuia declarat niste variabile ca integer
Codul complet este afisat mai jos:

Cod: Selectaţi tot

Option Explicit
Dim iCount As Long
Dim strSearch As String
Dim denTmp0, denTmp1, denTmp2, denTmp3, denTmp4, denTmp5, denTmp6 As String
Dim denTot0, denTot1, denTot2, denTot3, denTot4, denTot5, denTot6 As Integer
Dim x, Response
Dim y As Integer
Dim denTpp0, denTpp1, denTpp2, denTpp3, denTpp4, denTpp5, denTpp6, denTpp7, denTpp8, denTpp9, denTpp10, denTpp11, denTpp12, denTpp13, denTpp14, denTpp15, denTpp16, denTpp17, denTpp18, denTpp19, denTpp20, denTpp21, denTpp22, denTpp23, denTpp24, denTpp25, denTpp26, denTpp27, denTpp28, denTpp29, denTpp30, denTpp31, denTpp32, denTpp33, denTpp34, denTpp35, denTpp36 As String
Dim denTtt0, denTtt1, denTtt2, denTtt3, denTtt4, denTtt5, denTtt6, denTtt7, denTtt8, denTtt9, denTtt10, denTtt11, denTtt12, denTtt13, denTtt14, denTtt15, denTtt16, denTtt17, denTtt18, denTtt19, denTtt20, denTtt21, denTtt22, denTtt23, denTtt24, denTtt25, denTtt26, denTtt27, denTtt28, denTtt29, denTtt30, denTtt31, denTtt32, denTtt33, denTtt34, denTtt35, denTtt36 As Integer

Sub SedintaTotala()


Selection.HomeKey Unit:=wdStory
    strSearch = " SRL"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp0 = "Nr. SRL-uri = " & iCount
denTot0 = iCount
    Debug.Print denTmp0
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = " SNC"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp1 = "Nr. SNC-uri = " & iCount
denTot1 = iCount
    Debug.Print denTmp1
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = " SA"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp2 = "Nr. SA-uri = " & iCount
denTot2 = iCount
    Debug.Print denTmp2
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = " SCM"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp3 = "Nr. SCM-uri = " & iCount
denTot3 = iCount
    Debug.Print denTmp3
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = "COOPERATIVA AGRICOLA"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp4 = "Nr. COOPERATIVA AGRICOLA = " & iCount
denTot4 = iCount
    Debug.Print denTmp4
Selection.HomeKey Unit:=wdStory
End If
''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = "PERSOAN"
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp5 = "PERSOANA FIZICA AUTORIZATA = " & iCount
denTot5 = iCount
    Debug.Print denTmp5
Selection.HomeKey Unit:=wdStory
End If

''''''''''''''''''''''''''''
Selection.HomeKey Unit:=wdStory
    strSearch = "ÎNTREPRINDERE "
    iCount = 0
If Application.Documents.Count >= 1 Then
    With ActiveDocument.Content.Find
        .Text = strSearch
        .Format = False
        .Wrap = wdFindStop
        Do While .Execute
            iCount = iCount + 1
        Loop
    End With
denTmp6 = "ÎNTREPRINDERE INDIVIDUALA + FAMILIALA = " & iCount
denTot6 = iCount
    Debug.Print denTmp6
Selection.EndKey Unit:=wdStory
End If



''''''''''''''''''''''''''''

'Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
   Selection.TypeText Text:=Chr(13) & Chr(13)
   If denTmp0 <> "Nr. SRL-uri = 0" Then
    Selection.TypeText Text:=denTmp0 & Chr(13)
    End If
    If denTmp1 <> "Nr. SNC-uri = 0" Then
    Selection.TypeText Text:=denTmp1 & Chr(13)
    End If
    If denTmp2 <> "Nr. SA-uri = 0" Then
    Selection.TypeText Text:=denTmp2 & Chr(13)
    End If
    If denTmp3 <> "Nr. SCM-uri = 0" Then
    Selection.TypeText Text:=denTmp3 & Chr(13)
    End If
    If denTmp4 <> "Nr. COOPERATIVA AGRICOLA = 0" Then
    Selection.TypeText Text:=denTmp4 & Chr(13)
    End If
    If denTmp5 <> "PERSOANA FIZICA AUTORIZATA = 0" Then
    Selection.TypeText Text:=denTmp5 & Chr(13)
    End If
    If denTmp6 <> "ÎNTREPRINDERE INDIVIDUALA + FAMILIALA = 0" Then
    Selection.TypeText Text:=denTmp6 & Chr(13)
    End If
    Selection.TypeText Text:=Chr(13) & "--------------------------" & Chr(13)
            

    Call TipCerere
End Sub


Function TipCerere()

x = "Anulare rezervare"
y = 0
With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp0 = x & " = " & y
denTtt0 = y
    Debug.Print denTpp0
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Anulare rezervare emblem" & ChrW(259)
y = 0
With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp1 = x & " = " & y
denTtt1 = y
    Debug.Print denTpp1
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "CCFIL"
y = 0
With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp2 = x & " = " & y
denTtt2 = y
    Debug.Print denTpp2
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere cale de atac"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp3 = x & " = " & y
denTtt3 = y
    Debug.Print denTpp3
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de audien" & ChrW(355) & ChrW(259) & " public" & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp4 = x & " = " & y
denTtt4 = y
    Debug.Print denTpp4
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de completare/retragere acte"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp5 = x & " = " & y
denTtt5 = y
    Debug.Print denTpp5
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de depunere situatie financiar" & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp6 = x & " = " & y
denTtt6 = y
    Debug.Print denTpp6
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de depunere-mentionare acte"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp7 = x & " = " & y
denTtt7 = y
    Debug.Print denTpp7
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de eliberare duplicat"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp8 = x & " = " & y
denTtt8 = y
    Debug.Print denTpp8
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de modificare termen de solu" & ChrW(355) & "ionare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp9 = x & " = " & y
denTtt9 = y
    Debug.Print denTpp9
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de notific" & ChrW(259) & "ri activit" & ChrW(259) & ChrW(355) & "i la sedii"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp10 = x & " = " & y
denTtt10 = y
    Debug.Print denTpp10
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de preschimbare certificate"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp11 = x & " = " & y
denTtt11 = y
    Debug.Print denTpp11
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de renuntare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp12 = x & " = " & y
denTtt12 = y
    Debug.Print denTpp12
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere de servicii de asisten" & ChrW(355) & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp13 = x & " = " & y
denTtt13 = y
    Debug.Print denTpp13
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere numire expert"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp14 = x & " = " & y
denTtt14 = y
    Debug.Print denTpp14
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Cerere verificare sedii"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp15 = x & " = " & y
denTtt15 = y
    Debug.Print denTpp15
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Concordat preventive"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp16 = x & " = " & y
denTtt16 = y
    Debug.Print denTpp16
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Eliberare informa" & ChrW(355) & "ii"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp17 = x & " = " & y
denTtt17 = y
    Debug.Print denTpp17
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Eliberare inscrisuri bulk"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp18 = x & " = " & y
denTtt18 = y
    Debug.Print denTpp18
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Eliberare înscrisuri"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp19 = x & " = " & y
denTtt19 = y
    Debug.Print denTpp19
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Erori materiale"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp20 = x & " = " & y
denTtt20 = y
    Debug.Print denTpp20
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Men" & ChrW(355) & "iune"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp21 = x & " = " & y
denTtt21 = y
    Debug.Print denTpp21
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Men" & ChrW(355) & "iune de denominare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp22 = x & " = " & y
denTtt22 = y
    Debug.Print denTpp22
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Nota interna"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp23 = x & " = " & y
denTtt23 = y
    Debug.Print denTpp23
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Oficiu"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp24 = x & " = " & y
denTtt24 = y
    Debug.Print denTpp24
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Prelungire rezervare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp25 = x & " = " & y
denTtt25 = y
    Debug.Print denTpp25
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Prelungire rezervare emblem" & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp26 = x & " = " & y
denTtt26 = y
    Debug.Print denTpp26
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Preschimbare obiecte de activitate"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp27 = x & " = " & y
denTtt27 = y
    Debug.Print denTpp27
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Procedura de insolven" & ChrW(355) & ChrW(259)
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp28 = x & " = " & y
denTtt28 = y
    Debug.Print denTpp28
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Prospecte de emisiuni"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp29 = x & " = " & y
denTtt29 = y
    Debug.Print denTpp29
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Radiere firma"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp30 = x & " = " & y
denTtt30 = y
    Debug.Print denTpp30
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Radiere men" & ChrW(355) & "iune"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp31 = x & " = " & y
denTtt31 = y
    Debug.Print denTpp31
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Radierea unei radieri"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp32 = x & " = " & y
denTtt32 = y
    Debug.Print denTpp32
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Rezervare Emblema"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp33 = x & " = " & y
denTtt33 = y
    Debug.Print denTpp33
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Rezervare denumire"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp34 = x & " = " & y
denTtt34 = y
    Debug.Print denTpp34
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Verificare unicitate asociat"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp35 = x & " = " & y
denTtt35 = y
    Debug.Print denTpp35
Selection.HomeKey Unit:=wdStory
''''''''''''''''''''
x = "Înmatriculare"
y = 0
    With ActiveDocument.Content.Find
        Do While .Execute(findText:=x, Forward:=True, Format:=True, _
    MatchWildcards:=True) = True
           y = y + 1
        Loop
    End With

denTpp36 = x & " = " & y
denTtt36 = y
    Debug.Print denTpp0
Selection.EndKey Unit:=wdStory
''''''''''''''''''''
'If denTpp0 <> "Anulare rezervare = 0"  Then
'    Selection.TypeText Text:=denTpp0 & Chr(13)
'    End If
If denTpp1 <> "Anulare rezervare emblem" & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTpp1 & Chr(13)
    End If
If denTpp2 <> "CCFIL = 0" Then
    Selection.TypeText Text:=denTpp2 & Chr(13)
    End If
If denTpp3 <> "Cerere cale de atac = 0" Then
    Selection.TypeText Text:=denTpp3 & Chr(13)
    End If
If denTpp4 <> "Cerere de audien" & ChrW(355) & ChrW(259) & " public" & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTpp4 & Chr(13)
    End If
If denTpp5 <> "Cerere de completare/retragere acte = 0" Then
    Selection.TypeText Text:=denTpp5 & Chr(13)
    End If
If denTpp6 <> "Cerere de depunere situatie financiar" & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTpp6 & Chr(13)
    End If
If denTpp7 <> "Cerere de depunere-mentionare acte = 0" Then
    Selection.TypeText Text:=denTpp7 & Chr(13)
    End If
If denTpp8 <> "Cerere de eliberare duplicat = 0" Then
    Selection.TypeText Text:=denTpp8 & Chr(13)
    End If
If denTpp9 <> "Cerere de modificare termen de solu" & ChrW(355) & "ionare = 0" Then
    Selection.TypeText Text:=denTpp9 & Chr(13)
    End If
If denTpp10 <> "Cerere de notific" & ChrW(259) & "ri activit" & ChrW(259) & ChrW(355) & "i la sedii = 0" Then
    Selection.TypeText Text:=denTpp10 & Chr(13)
    End If
If denTpp11 <> "Cerere de preschimbare certificate = 0" Then
    Selection.TypeText Text:=denTpp11 & Chr(13)
    End If
If denTpp12 <> "Cerere de renuntare = 0" Then
    Selection.TypeText Text:=denTpp12 & Chr(13)
    End If
If denTpp13 <> "Cerere de servicii de asisten" & ChrW(355) & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTpp13 & Chr(13)
    End If
If denTpp14 <> "Cerere numire expert = 0" Then
    Selection.TypeText Text:=denTpp14 & Chr(13)
    End If
If denTpp15 <> "Cerere verificare sedii = 0" Then
    Selection.TypeText Text:=denTpp15 & Chr(13)
    End If
If denTpp16 <> "Concordat preventive = 0" Then
    Selection.TypeText Text:=denTpp16 & Chr(13)
    End If
If denTpp17 <> "Eliberare informa" & ChrW(355) & "ii = 0" Then
    Selection.TypeText Text:=denTpp17 & Chr(13)
    End If
If denTpp18 <> "Eliberare inscrisuri bulk = 0" Then
    Selection.TypeText Text:=denTpp18 & Chr(13)
    End If
If denTpp19 <> "Eliberare înscrisuri = 0" Then
    Selection.TypeText Text:=denTpp19 & Chr(13)
    End If
If denTpp20 <> "Erori materiale = 0" Then
    Selection.TypeText Text:=denTpp20 & Chr(13)
    End If
If denTpp21 <> "Men" & ChrW(355) & "iune = 0" Then
    Selection.TypeText Text:=denTpp21 & Chr(13)
    End If
'If denTpp22 <> "Men" & ChrW(355) & "iune de denominare = 0"  Then
'    Selection.TypeText Text:=denTpp22 & Chr(13)
'    End If
If denTpp23 <> "Nota interna = 0" Then
    Selection.TypeText Text:=denTpp23 & Chr(13)
    End If
If denTpp24 <> "Oficiu = 0" Then
    Selection.TypeText Text:=denTpp24 & Chr(13)
    End If
'If denTpp25 <> "Prelungire rezervare = 0"  Then
'    Selection.TypeText Text:=denTpp25 & Chr(13)
'    End If
If denTpp26 <> "Prelungire rezervare emblem" & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTpp26 & Chr(13)
    End If
If denTpp27 <> "Preschimbare obiecte de activitate = 0" Then
    Selection.TypeText Text:=denTpp27 & Chr(13)
    End If
If denTpp28 <> "Procedura de insolven" & ChrW(355) & ChrW(259) & " = 0" Then
    Selection.TypeText Text:=denTpp28 & Chr(13)
    End If
If denTpp29 <> "Prospecte de emisiuni = 0" Then
    Selection.TypeText Text:=denTpp29 & Chr(13)
    End If
If denTpp30 <> "Radiere firma = 0" Then
    Selection.TypeText Text:=denTpp30 & Chr(13)
    End If
If denTpp31 <> "Radiere men" & ChrW(355) & "iune = 0" Then
    Selection.TypeText Text:=denTpp31 & Chr(13)
    End If
If denTpp32 <> "Radierea unei radieri = 0" Then
    Selection.TypeText Text:=denTpp32 & Chr(13)
    End If
If denTpp33 <> "Rezervare Emblema = 0" Then
    Selection.TypeText Text:=denTpp33 & Chr(13)
    End If
If denTpp34 <> "Rezervare denumire = 0" Then
    Selection.TypeText Text:=denTpp34 & Chr(13)
    End If
If denTpp35 <> "Verificare unicitate asociat = 0" Then
    Selection.TypeText Text:=denTpp35 & Chr(13)
    End If
If denTpp36 <> "Înmatriculare = 0" Then
    Selection.TypeText Text:=denTpp36 & Chr(13)
    End If
    
    Selection.TypeText Text:=Chr(13) & "--------------------------" & Chr(13)
            Selection.TypeText Text:="Total dosare sedinta = " & denTot0 + denTot1 + denTot2 + denTot3 + denTot4 - denTtt28 & Chr(13)
            Selection.TypeText Text:="Total dosare sedinta PJ = " & denTot0 + denTot1 + denTot2 + denTot3 + denTot4 & Chr(13)
            Selection.TypeText Text:="Total dosare sedinta PF = " & denTot5 + denTot6 & Chr(13)
            Selection.TypeText Text:="Total dosare = " & denTot0 + denTot1 + denTot2 + denTot3 + denTot4 + denTot5 + denTot6 & Chr(13)
    Selection.TypeText Text:=Chr(13) & "--------------------------" & Chr(13)

End Function
Problema rezolvata, se poate inchide

Închis

Înapoi la “Intrebari despre Word 2010”