Hi all I'm writitng a template that adds a combo box tothe standard controlbar. but when saving the document it also wants to save changes to the .dot file also.
VB Code:
Private Sub Document_New() Dim cboNames As CommandBarComboBox Dim objToolbar As CommandBar Dim conTelList As ADODB.Connection Dim recNames As ADODB.Recordset Dim strQuery As String 'establish the connection to DB Set conTelList = New ADODB.Connection conTelList.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Lvp-web\published\websites\Ganda intranet\_databases\phone_internal2000.mdb;Persist Security Info=False" strQuery = "Select Firstname,Surname,Location,ext,email" strQuery = strQuery & " From Employees where Firstname <>" & """ & """ 'Set an ope the recordset Set recNames = New ADODB.Recordset recNames.Open strQuery, conTelList 'Get hold of the Standard CommandBar Set objToolbar = ActiveDocument.CommandBars("standard") 'Insert the ComboBox into the Standard CaommandBar Set cboNames = objToolbar.Controls.Add(Type:=msoControlComboBox, _ Temporary:=True) 'Set Fill cboNames and set up properties With cboNames 'Loop throught the Recordset and populate the ComboBox Do While Not recNames.EOF .AddItem recNames!firstname & Space$(1) & recNames!Surname recNames.MoveNext Loop 'While Not recNames.EOF .TooltipText = "Names" .Text = "Select Name" .OnAction = "Selection" .Width = 155 .DropDownWidth = 155 End With 'cboNames ' End Sub
Why is the dot file being modified any help please would be great!!!!!




Reply With Quote