Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Properties Stoney Currie[_2_] Excel Discussion (Misc queries) 1 April 30th 10 02:02 AM
Excel Display Properties Susal Excel Discussion (Misc queries) 1 June 14th 07 01:12 AM
Excel Properties Harley New Users to Excel 2 January 19th 06 11:26 PM
How to get column properties in excel?? Kasi Murthy Setting up and Configuration of Excel 0 September 27th 05 07:19 PM
Excel properties Kevin Excel Programming 7 August 7th 03 10:36 AM


All times are GMT +1. The time now is 01:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"