PDA

View Full Version : Fould in Word.dot



felix85
03-24-2009, 01:05 AM
Hello People..

Does anywone knows what this fould means?

This is an fould that I get when I open Word.dot userform!?!

Fout -2147467259 (80004005) tijdens uitvoering:
[Microsoft][ODBC Excel-stuurprogramma]Algemene fout Kan de registersleutel Temporary (volatile) Jet DSN for process 0xfac Thread 0x95c DBC 0x1f99754 Excel niet openen.

This code I use in Word:
_____________________________________________________
Private Sub UserForm_Initialize()
Set conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
conn.Open "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" & ActiveDocument.Path & "\Gegevens Gulpen-Wittem.xls;"
rs.Open "SELECT * FROM [Sheet1$]", conn
Do While Not rs.EOF
ComboBox1.AddItem rs("Zoeken")
rs.MoveNext
Loop
rs.Close: Set rs = Nothing
conn.Close: Set conn = Nothing
End Sub
___________________________________________________________
Private Sub Invoegen_Click()
Set conn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
conn.Open "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" & ActiveDocument.Path & "\Gegevens Gulpen-Wittem.xls;"
rs.Open "SELECT * FROM [Sheet1$] WHERE Zoeken = '" & ComboBox1 & "'", conn
Selection.GoTo wdGoToBookmark, , , "Naam"
Selection.TypeText rs("Naam")
Selection.GoTo wdGoToBookmark, , , "Adres"
Selection.TypeText rs("Adres")
Selection.GoTo wdGoToBookmark, , , "Plaats"
Selection.TypeText rs("Postcode") & " " & rs("Plaats")
End Sub

felix85
03-24-2009, 07:37 AM
This Fould is only when I open the .dot file.. When I save the same file as an .doc file, there are now problems..

Sow I can't make an template, are there other ways to do what I wan't..

Maybe I can make an code in vb that does save the text in the userform after saving under an new name?? When I open the saved file that the text is always in the saved file??

Please if anybody knows how?!?