• Privacywetgeving
    Het is bij Helpmij.nl niet toegestaan om persoonsgegevens in een voorbeeld te plaatsen. Alle voorbeelden die persoonsgegevens bevatten zullen zonder opgaaf van reden verwijderd worden. In de vraag zal specifiek vermeld moeten worden dat het om fictieve namen gaat.

Word met excel koppelen

Status
Niet open voor verdere reacties.
Als je dubbelklikt om de velden in Word, verschijnt een menu met onder meer de naam.

Met vriendelijke groet,


Roncancio

Maakt het uit nog uit of we te maken hebben met tekstvelden of Checkboxen?
Als ik dubbelklik in Word dan krijg ik een Text Form Field informatie balk.
Staat dat misschien ergens anders gegeven?

Groet,
Romario
 
Code:
            Range("B" & intCtl).Value = wrdDoc.FormFields(intCtl).CheckBox.Value  
            Range("B" & intCtl).Value = wrdDoc.FormFields(intCtl).TextBox.Value

intCtl van Range vervangen door regelnummer.
intCtl van FormField vervangen door nummer van formfield.

Met vriendelijke groet,


Roncancio
 
Code:
            Range("B" & intCtl).Value = wrdDoc.FormFields(intCtl).CheckBox.Value  
            Range("B" & intCtl).Value = wrdDoc.FormFields(intCtl).TextBox.Value

intCtl van Range vervangen door regelnummer.
intCtl van FormField vervangen door nummer van formfield.

Met vriendelijke groet,


Roncancio

Code:
Range("B" & intCtl).Value = wrdDoc.FormFields(intCtl).CheckBox.Value  
Range("B" & intCtl).Value = wrdDoc.FormFields(intCtl).TextBox.Value
Nieuw
Range("B" & b11).Value = wrdDoc.FormFields(Check1).CheckBox.Value  
Range("B" & 2).Value = wrdDoc.FormFields(Text2).TextBox.Value

Dan zou het code er zo uit komen te zien?
 
Code:
Range("B11").Value = wrdDoc.FormFields(Check1).CheckBox.Value  
Range("B2").Value = wrdDoc.FormFields(Text2).TextBox.Value

Met vriendelijke groet,


Roncancio
 
Code:
Range("B11").Value = wrdDoc.FormFields(Check1).CheckBox.Value  
Range("B2").Value = wrdDoc.FormFields(Text2).TextBox.Value

Met vriendelijke groet,


Roncancio

Ik snap, en je maakt telkens een nieuwe aan voor elke zinsregel en voor checkbox.
Ik heb alle Form velden nagelopen in Word en sommige zijn nog niet ingedeeld.
Kan ik die dan zelf toewijzen doormiddel van Check3 en Text3 bijvoorbeeld?
En moet er voor elke nieuwe code regel Range voor?
 
Ja.

Ja, anders weet VBA niet wat je bedoelt.

Met vriendelijke groet,


Roncancio

Ik heb alle codes met de hand ingevoerd van B1 tot en met B82 en nog krijg ik hem niet recht!

Code:
 Sub Evaluatie()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim intCnt As Integer
Dim lngRow As Long
Dim intChk As Integer
Dim intCtl As Integer
Dim blnEmp As Boolean

    On Error Resume Next
    Set wrdApp = CreateObject("Word.Application")
    wrdApp.Visible = True
    Set wrdDoc = wrdApp.Documents.Open("C:\Documents and Settings\55006\Desktop\CIF.doc")
    intChk = wrdDoc.FormFields.Count
    blnEmp = True
    
    For intCtl = 2 To intChk
        If wrdDoc.FormFields(intCtl).Type = wdFieldFormCheckBox Then
            Range("B12").Value = wrdDoc.FormFields(2).CheckBox.Value
            Range("C12").Value = wrdDoc.FormFields(1).CheckBox.Value
            Range("D12").Value = wrdDoc.FormFields(3).CheckBox.Value
            Range("B20").Value = wrdDoc.FormFields(4).CheckBox.Value
            Range("B21").Value = wrdDoc.FormFields(5).CheckBox.Value
            Range("B22").Value = wrdDoc.FormFields(6).CheckBox.Value
            Range("B23").Value = wrdDoc.FormFields(7).CheckBox.Value
            Range("B26").Value = wrdDoc.FormFields(8).CheckBox.Value
            Range("B27").Value = wrdDoc.FormFields(9).CheckBox.Value
            Range("B29").Value = wrdDoc.FormFields(10).CheckBox.Value
            Range("B30").Value = wrdDoc.FormFields(11).CheckBox.Value
            Range("B31").Value = wrdDoc.FormFields(12).CheckBox.Value
            Range("B33").Value = wrdDoc.FormFields(13).CheckBox.Value
            Range("B34").Value = wrdDoc.FormFields(14).CheckBox.Value
            Range("B35").Value = wrdDoc.FormFields(15).CheckBox.Value
            Range("B37").Value = wrdDoc.FormFields(16).CheckBox.Value
            Range("B39").Value = wrdDoc.FormFields(17).CheckBox.Value
            Range("B41").Value = wrdDoc.FormFields(18).CheckBox.Value
            Range("B43").Value = wrdDoc.FormFields(19).CheckBox.Value
            Range("B44").Value = wrdDoc.FormFields(20).CheckBox.Value
            Range("B45").Value = wrdDoc.FormFields(21).CheckBox.Value
            Range("B46").Value = wrdDoc.FormFields(22).CheckBox.Value
            Range("B47").Value = wrdDoc.FormFields(23).CheckBox.Value
            Range("B48").Value = wrdDoc.FormFields(24).CheckBox.Value
            Range("B55").Value = wrdDoc.FormFields(25).CheckBox.Value
            Range("B55").Value = wrdDoc.FormFields(26).CheckBox.Value
            Range("B58").Value = wrdDoc.FormFields(27).CheckBox.Value
            Range("B58").Value = wrdDoc.FormFields(28).CheckBox.Value
            Range("B60").Value = wrdDoc.FormFields(29).CheckBox.Value
            Range("B60").Value = wrdDoc.FormFields(30).CheckBox.Value
            Range("B62").Value = wrdDoc.FormFields(31).CheckBox.Value
            Range("B62").Value = wrdDoc.FormFields(32).CheckBox.Value
            Range("B66").Value = wrdDoc.FormFields(33).CheckBox.Value
            Range("B66").Value = wrdDoc.FormFields(34).CheckBox.Value
            Range("B70").Value = wrdDoc.FormFields(35).CheckBox.Value
            Range("B71").Value = wrdDoc.FormFields(36).CheckBox.Value
            Range("B72").Value = wrdDoc.FormFields(37).CheckBox.Value
            Range("B73").Value = wrdDoc.FormFields(38).CheckBox.Value
            Range("B74").Value = wrdDoc.FormFields(39).CheckBox.Value
            Range("B75").Value = wrdDoc.FormFields(40).CheckBox.Value
            Range("B76").Value = wrdDoc.FormFields(41).CheckBox.Value
            Range("B77").Value = wrdDoc.FormFields(42).CheckBox.Value
            Range("B78").Value = wrdDoc.FormFields(43).CheckBox.Value
            Range("B79").Value = wrdDoc.FormFields(44).CheckBox.Value
            Range("B80").Value = wrdDoc.FormFields(45).CheckBox.Value
            Range("B81").Value = wrdDoc.FormFields(46).CheckBox.Value
            Range("B82").Value = wrdDoc.FormFields(47).CheckBox.Value
        ElseIf wrdDoc.FormFields(intCtl).Type = wdFieldFormTextInput Then
            Range("B1").Value = wrdDoc.FormFields(48).Result
            Range("B2").Value = wrdDoc.FormFields(38).Result
            Range("B3").Value = wrdDoc.FormFields(1).Result
            Range("B4").Value = wrdDoc.FormFields(2).Result
            Range("B5").Value = wrdDoc.FormFields(3).Result
            Range("B6").Value = wrdDoc.FormFields(4).Result
            Range("B7").Value = wrdDoc.FormFields(5).Result
            Range("B8").Value = wrdDoc.FormFields(9).Result
            Range("B9").Value = wrdDoc.FormFields(7).Result
            Range("B10").Value = wrdDoc.FormFields(8).Result
            Range("E12").Value = wrdDoc.FormFields(6).Result
            Range("B13").Value = wrdDoc.FormFields(11).Result
            Range("B14").Value = wrdDoc.FormFields(12).Result
            Range("B15").Value = wrdDoc.FormFields(13).Result
            Range("B16").Value = wrdDoc.FormFields(62).Result
            Range("B17").Value = wrdDoc.FormFields(14).Result
            Range("B18").Value = wrdDoc.FormFields(63).Result
            Range("B50").Value = wrdDoc.FormFields(29).Result
            Range("B51").Value = wrdDoc.FormFields(30).Result
            Range("B52").Value = wrdDoc.FormFields(31).Result
            Range("B53").Value = wrdDoc.FormFields(32).Result
            Range("B56").Value = wrdDoc.FormFields(60).Result
            Range("B57").Value = wrdDoc.FormFields(61).Result
            Range("B59").Value = wrdDoc.FormFields(33).Result
            Range("B61").Value = wrdDoc.FormFields(34).Result
            Range("B63").Value = wrdDoc.FormFields(57).Result
            Range("B64").Value = wrdDoc.FormFields(58).Result
            Range("B65").Value = wrdDoc.FormFields(35).Result
            Range("B67").Value = wrdDoc.FormFields(36).Result
            Range("B68").Value = wrdDoc.FormFields(37).Result
            Range("C82").Value = wrdDoc.FormFields(39).Result
            Range("C83").Value = wrdDoc.FormFields(40).Result
            Range("C84").Value = wrdDoc.FormFields(41).Result
            Range("C85").Value = wrdDoc.FormFields(42).Result
            Range("C86").Value = wrdDoc.FormFields(43).Result
            
        
                End If
    Next
  
    wrdApp.Quit
    Set wrdDoc = Nothing
    Set wrdApp = Nothing
    ActiveWorkbook.Saved = True
End Sub

Groet,
Romario
 
Een paar opmerkingen:
Ik mis Textbox
Code:
Range("B2").Value = wrdDoc.FormFields(Text2).[B][COLOR="red"]TextBox[/COLOR][/B].Value

De For... Next lus als mede de IF, Else en End If kan je verwijderen.

Wat gaat er precies niet goed?

Met vriendelijke groet,


Roncancio
 
Een paar opmerkingen:
Ik mis Textbox
Code:
Range("B2").Value = wrdDoc.FormFields(Text2).[B][COLOR="red"]TextBox[/COLOR][/B].Value

De For... Next lus als mede de IF, Else en End If kan je verwijderen.

Wat gaat er precies niet goed?

Met vriendelijke groet,


Roncancio

Code:
 Sub Evaluatie()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim intCnt As Integer
Dim lngRow As Long
Dim intChk As Integer
Dim intCtl As Integer
Dim blnEmp As Boolean

    On Error Resume Next
    Set wrdApp = CreateObject("Word.Application")
    wrdApp.Visible = True
    Set wrdDoc = wrdApp.Documents.Open("C:\Documents and Settings\55006\Desktop\CIF.doc")
    intChk = wrdDoc.FormFields.Count
    blnEmp = True
 
        If wrdDoc.FormFields(intCtl).Type = wdFieldFormCheckBox Then
            Range("B12").Value = wrdDoc.FormFields(2).CheckBox.Value
            Range("C12").Value = wrdDoc.FormFields(1).CheckBox.Value
            Range("D12").Value = wrdDoc.FormFields(3).CheckBox.Value
            Range("B20").Value = wrdDoc.FormFields(4).CheckBox.Value
            Range("B21").Value = wrdDoc.FormFields(5).CheckBox.Value
            Range("B22").Value = wrdDoc.FormFields(6).CheckBox.Value
            Range("B23").Value = wrdDoc.FormFields(7).CheckBox.Value
            Range("B26").Value = wrdDoc.FormFields(8).CheckBox.Value
            Range("B27").Value = wrdDoc.FormFields(9).CheckBox.Value
            Range("B29").Value = wrdDoc.FormFields(10).CheckBox.Value
            Range("B30").Value = wrdDoc.FormFields(11).CheckBox.Value
            Range("B31").Value = wrdDoc.FormFields(12).CheckBox.Value
            Range("B33").Value = wrdDoc.FormFields(13).CheckBox.Value
            Range("B34").Value = wrdDoc.FormFields(14).CheckBox.Value
            Range("B35").Value = wrdDoc.FormFields(15).CheckBox.Value
            Range("B37").Value = wrdDoc.FormFields(16).CheckBox.Value
            Range("B39").Value = wrdDoc.FormFields(17).CheckBox.Value
            Range("B41").Value = wrdDoc.FormFields(18).CheckBox.Value
            Range("B43").Value = wrdDoc.FormFields(19).CheckBox.Value
            Range("B44").Value = wrdDoc.FormFields(20).CheckBox.Value
            Range("B45").Value = wrdDoc.FormFields(21).CheckBox.Value
            Range("B46").Value = wrdDoc.FormFields(22).CheckBox.Value
            Range("B47").Value = wrdDoc.FormFields(23).CheckBox.Value
            Range("B48").Value = wrdDoc.FormFields(24).CheckBox.Value
            Range("B55").Value = wrdDoc.FormFields(25).CheckBox.Value
            Range("B55").Value = wrdDoc.FormFields(26).CheckBox.Value
            Range("B58").Value = wrdDoc.FormFields(27).CheckBox.Value
            Range("B58").Value = wrdDoc.FormFields(28).CheckBox.Value
            Range("B60").Value = wrdDoc.FormFields(29).CheckBox.Value
            Range("B60").Value = wrdDoc.FormFields(30).CheckBox.Value
            Range("B62").Value = wrdDoc.FormFields(31).CheckBox.Value
            Range("B62").Value = wrdDoc.FormFields(32).CheckBox.Value
            Range("B66").Value = wrdDoc.FormFields(33).CheckBox.Value
            Range("B66").Value = wrdDoc.FormFields(34).CheckBox.Value
            Range("B70").Value = wrdDoc.FormFields(35).CheckBox.Value
            Range("B71").Value = wrdDoc.FormFields(36).CheckBox.Value
            Range("B72").Value = wrdDoc.FormFields(37).CheckBox.Value
            Range("B73").Value = wrdDoc.FormFields(38).CheckBox.Value
            Range("B74").Value = wrdDoc.FormFields(39).CheckBox.Value
            Range("B75").Value = wrdDoc.FormFields(40).CheckBox.Value
            Range("B76").Value = wrdDoc.FormFields(41).CheckBox.Value
            Range("B77").Value = wrdDoc.FormFields(42).CheckBox.Value
            Range("B78").Value = wrdDoc.FormFields(43).CheckBox.Value
            Range("B79").Value = wrdDoc.FormFields(44).CheckBox.Value
            Range("B80").Value = wrdDoc.FormFields(45).CheckBox.Value
            Range("B81").Value = wrdDoc.FormFields(46).CheckBox.Value
            Range("B82").Value = wrdDoc.FormFields(47).CheckBox.Value
        ElseIf wrdDoc.FormFields(intCtl).Type = wdFieldFormTextInput Then
            Range("B1").Value = wrdDoc.FormFields(Text1).TextBox.Value
            Range("B2").Value = wrdDoc.FormFields(Text2).TextBox.Value
            Range("B3").Value = wrdDoc.FormFields(Text3).TextBox.Value
            Range("B4").Value = wrdDoc.FormFields(Text4).TextBox.Value
            Range("B5").Value = wrdDoc.FormFields(Text5).TextBox.Value
            Range("B6").Value = wrdDoc.FormFields(Text6).TextBox.Value
            Range("B7").Value = wrdDoc.FormFields(Text7).TextBox.Value
            Range("B8").Value = wrdDoc.FormFields(Text8).TextBox.Value
            Range("B9").Value = wrdDoc.FormFields(Text9).TextBox.Value
            Range("B10").Value = wrdDoc.FormFields(Text10).TextBox.Value
            Range("E12").Value = wrdDoc.FormFields(Text11).TextBox.Value
            Range("B13").Value = wrdDoc.FormFields(Text12).TextBox.Value
            Range("B14").Value = wrdDoc.FormFields(Text13).TextBox.Value
            Range("B15").Value = wrdDoc.FormFields(Text14).TextBox.Value
            Range("B16").Value = wrdDoc.FormFields(Text15).TextBox.Value
            Range("B17").Value = wrdDoc.FormFields(Text16).TextBox.Value
            Range("B18").Value = wrdDoc.FormFields(Text17).TextBox.Value
            Range("B50").Value = wrdDoc.FormFields(Text29).TextBox.Value
            Range("B51").Value = wrdDoc.FormFields(Text30).TextBox.Value
            Range("B52").Value = wrdDoc.FormFields(Text31).TextBox.Value
            Range("B53").Value = wrdDoc.FormFields(Text32).TextBox.Value
            Range("B56").Value = wrdDoc.FormFields(Text60).TextBox.Value
            Range("B57").Value = wrdDoc.FormFields(Text61).TextBox.Value
            Range("B59").Value = wrdDoc.FormFields(Text33).TextBox.Value
            Range("B61").Value = wrdDoc.FormFields(Text34).TextBox.Value
            Range("B63").Value = wrdDoc.FormFields(Text57).TextBox.Value
            Range("B64").Value = wrdDoc.FormFields(Text58).TextBox.Value
            Range("B65").Value = wrdDoc.FormFields(Text35).TextBox.Value
            Range("B67").Value = wrdDoc.FormFields(Text36).TextBox.Value
            Range("B68").Value = wrdDoc.FormFields(Text37).TextBox.Value
            Range("C82").Value = wrdDoc.FormFields(Text39).TextBox.Value
            Range("C83").Value = wrdDoc.FormFields(Text40).TextBox.Value
            Range("C84").Value = wrdDoc.FormFields(Text41).TextBox.Value
            Range("C85").Value = wrdDoc.FormFields(Text42).TextBox.Value
            Range("C86").Value = wrdDoc.FormFields(Text43).TextBox.Value
            
        
  
    wrdApp.Quit
    Set wrdDoc = Nothing
    Set wrdApp = Nothing
    ActiveWorkbook.Saved = True
End Sub

Op een of andere manier krijg ik hem niet recht onder mekaar en vult ie deze gegevens in andere velden.

Nu ik TextBox.Value geplaatst hebt, leest hij helemaal niks meer en zegt ie dat de methode niet bekend is.?!:shocked:Bekijk bijlage Book1.xlsBekijk bijlage CIF1.docBekijk bijlage CIF 2.doc

Ik heb het WoRd document in twee gedeeld, anders was hij te groot.

Groet,
Romario
 
Zo werkt het wel.

Met vriendelijke groet,


Roncancio
 

Bijlagen

  • Book1.xls
    54 KB · Weergaven: 25
Je verwees bijvoorbeeld naar Checkbox(44) ipv "Check44".
De naam van de checkbox is Check44. Met Checkbox(44) bedoel je het 44e veld.

Met vriendelijke groet,


Roncancio
 
Je verwees bijvoorbeeld naar Checkbox(44) ipv "Check44".
De naam van de checkbox is Check44. Met Checkbox(44) bedoel je het 44e veld.

Met vriendelijke groet,


Roncancio

Oké Duidelijk! Super bedankt voor alle info en hulp! Ik zet hem weer op opgelost!

Groet,
Romario
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan