Aug 25th, 2004, 04:59 AM
#1
Thread Starter
Fanatic Member
Stop asking template to save
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!!!!!
Useful Links
.Net
#Develop ,
GhostDoc ,
CodeKeep ,
be.PINVOKE ,
Good Code Snippet Site
Krypton Toolkit ,
XPCC / XP Common Controls ,
QSS Windows Forms Components
VB.COM
VB.Classic Help File ,
MB Controls ,
MZTools ,
ADO Stored Procedure Generator add-in ,
Aug 25th, 2004, 08:30 AM
#2
Thread Starter
Fanatic Member
Herse an example of what i am doing
Attached Files
Useful Links
.Net
#Develop ,
GhostDoc ,
CodeKeep ,
be.PINVOKE ,
Good Code Snippet Site
Krypton Toolkit ,
XPCC / XP Common Controls ,
QSS Windows Forms Components
VB.COM
VB.Classic Help File ,
MB Controls ,
MZTools ,
ADO Stored Procedure Generator add-in ,
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width