Prosim o pomoc s VBA kodem pro Access a Word 2002. Zapasim s Exportem OLE-Objektu (Word text) ulozenym v tabulce Accessu do Word Templet dokumentu. Ve vytvorenem Formulari mam checkBoxy a kliknutim na tlacitko "Word Export" sestavim z jednotlivych "puzzle" casti dopis. Zde je dulezite aby se texty neprepisovaly, byly za sebou a to ne chaoticky ale v urcitem poradi. S ruznou pomoci jsem docilil nasledujici kod ktery ale nepracuje jak bych potreboval. Na prani zaslu ZIP soubor. Dekuji! ([email protected]) Private Sub Befehl25_Click() Dim rs As DAO.Recordset Dim obj As Object 'word dokument erstellen Dim tmpdoc As Word.Document Dim Word As Word.Application, WordDoc As Word.Document On Error Resume Next On Error Resume Next ' Läuft Word ? Set Word = GetObject(, "Word.Application") If Err.Number <> 0 Then ' Word läuft nicht Err.Clear Set Word = CreateObject("Word.Application") Else Word.Activate End If 'templet = "F:\word_export.dot" Set WordDoc = Word.Documents.Add 'ende word doc If Me.Rahmen10.Value = 1 Then tabelle = "deutsch" Else tabelle = "english" End If For i = 1 To 3 If Me.Controls("auswahlservice" & i).Value = True Then abfragestring = "SELECT * From " & tabelle & " where checkbox = " & "'auswahlservice" & i & "' ;" Set rs = Application.CurrentDb.openrecordset(abfragestring, dbOpenForwardOnly) MsgBox (rs(2).Type) obj = rs(2) obj.Action = 4 obj.Verb = 0 obj.Action = 5 Word.Selection = "" End If Next i Set WordDoc = Nothing Set rs = Nothing Set Word = Nothing End Sub
|