Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel properties
Hi all,
I used some code to force people to fill in the properties in word. Then i adapted the code to excel as follows: Private Sub CommandButton1_Click() If (ComboBox1.Value = "") Then MsgBox ("You need to fill in the department.") ElseIf InStr(1, TextBox2.Value, "Fill in the author", vbTextCompare) < 0 Then MsgBox ("You need to fill in the author.") ElseIf (TextBox2.Value = "") Then MsgBox ("You need to fill in the author.") ElseIf InStr(1, TextBox2.Value, "Fill in the keywords", vbTextCompare) < 0 Then MsgBox ("You need to fill in the keywords.") ElseIf (TextBox2.Value = "") Then MsgBox ("You need to fill in the keywords.") ElseIf InStr(1, TextBox3.Value, "Fill in the title", vbTextCompare) < 0 Then MsgBox ("You need to fill in the title.") ElseIf (TextBox3.Value = "") Then MsgBox ("You need to fill in the title.") ElseIf InStr(1, TextBox4.Value, "Fill in the subject", vbTextCompare) < 0 Then MsgBox ("You need to fill in the subject.") ElseIf (TextBox4.Value = "") Then MsgBox ("You need to fill in the subject.") Else Call WriteProp("Department", ComboBox1.Value) Call WriteProp("Author", TextBox1.Value) Call WriteProp("Keywords", TextBox2.Value) Call WriteProp("Title", TextBox3.Value) Call WriteProp("Subject", TextBox4.Value) Dialogs(xlDialogSaveAs).Show UserForm1.hide End If End Sub Private Sub UserForm_Initialize() Dim cn As ADODB.Connection, rs As ADODB.recordset TextBox1 = ReadProp("Author") TextBox2 = ReadProp("Keywords") TextBox3 = ReadProp("Title") TextBox4 = ReadProp("Subject") ComboBox1.Value = ReadProp("Department") ComboBox1.ColumnCount = 1 Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.JET.OLEDB.4.0; data source=\\server3\psi global\company_databases\Tec_Amendments.mdb;" Set rs = New ADODB.recordset With rs .Open "select department from department order by department", cn, , , adCmdText End With rs.MoveFirst Do While Not rs.EOF ComboBox1.AddItem rs.Fields(0).Value rs.moveNext Loop rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Sub But when the user clicks the button he refreshes the dialog (all empty fields), doesn't show the save as dialog and hangs the whole document. Does anyone know why this happens? It works fine in word. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel properties
The code in the previous message works fine in the vb editor after
slight change. But it doesn't work in the document itself. It shows the dialog but then it shows the dialog again instead of the save as dialog. After that it closes the dialog. (It seems like the savedialog became my dialog) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Properties | Excel Discussion (Misc queries) | |||
Excel Display Properties | Excel Discussion (Misc queries) | |||
Excel Properties | New Users to Excel | |||
How to get column properties in excel?? | Setting up and Configuration of Excel | |||
Excel properties | Excel Programming |