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 need to force users to fill in the properties menu for word and
excel.
I already did it with word. In excel I prompt the properties menu but
you can just click ok. I want the users to fill in everything before
they can save the document. Does anyone know how I can do this.

Thx.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Excel properties

Kevin,

Haven't tried it, but presumably you could code a loop that checks all of
the Builtin Document properties, and if one is not set, don't let them exit
the loop. You could also up the message, so as to 'encourage' them, for
instance, first time you put Please, second time, just tell them, third time
issue profanities<g. Of course, this doesn't stop them just entering
garbage just to shut you up.

How did you do it in Word, and why doesn't that work in Excel as well?

--

HTH

Bob Phillips

"Kevin" wrote in message
m...
Hi all,

I need to force users to fill in the properties menu for word and
excel.
I already did it with word. In excel I prompt the properties menu but
you can just click ok. I want the users to fill in everything before
they can save the document. Does anyone know how I can do this.

Thx.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel properties

Hey,

this is the sourcecode in vb word

Sub FileSave()
'
' FileSave Macro
' Saves the active document or template
'
Dim sMessage As String
sMessage = "You need to enter all the properties"
With Dialogs(wdDialogFileSummaryInfo)

StartDisplay:
If .Display = True Then
If .Title = "" Then
MsgBox sMessage
GoTo StartDisplay
ElseIf .Subject = "" Then
MsgBox sMessage
GoTo StartDisplay
ElseIf .Author = "" Then
MsgBox sMessage
GoTo StartDisplay
ElseIf .Keywords = "" Then
MsgBox sMessage
GoTo StartDisplay
ElseIf .Comments = "" Then
MsgBox sMessage
GoTo StartDisplay
Else
.Execute
End If
Else
MsgBox sMessage
GoTo StartDisplay
End If
End With
ActiveDocument.Save

End Sub

It doesn't work in excel because With Dialogs(wdDialogFileSummaryInfo)
is not defined.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Excel properties

This might work--put it under the ThisWorkbook module:

Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Dim myProperties As Variant
Dim iCtr As Long
Dim OkToContinue As Boolean

myProperties = Array("title", "subject", "Author", _
"manager", "company", "Category", "Keywords", "Comments")

OkToContinue = True
For iCtr = LBound(myProperties) To UBound(myProperties)
If Me.BuiltinDocumentProperties(myProperties(iCtr)).V alue = "" Then
OkToContinue = False
Exit For
End If
Next iCtr

If OkToContinue Then
'do nothing
Else
MsgBox "Please complete all the properties!" & vbLf & _
"Then try Saving your file again."
Application.Dialogs(xlDialogProperties).Show
Cancel = True 'stop the close
End If

End Sub

Take a look at all the builtinproperties in VBA's help. (I only chose a few.)
And depending on your version of excel, not all are available. So I'd try to
limit them to just the important ones. Else you'll get a lot of comments like
Bob suggested: aaaaaa, ....

Personally, I don't think I'd inflict this misery on the users.

Kevin Simons wrote:

Hey,

this is the sourcecode in vb word

Sub FileSave()
'
' FileSave Macro
' Saves the active document or template
'
Dim sMessage As String
sMessage = "You need to enter all the properties"
With Dialogs(wdDialogFileSummaryInfo)

StartDisplay:
If .Display = True Then
If .Title = "" Then
MsgBox sMessage
GoTo StartDisplay
ElseIf .Subject = "" Then
MsgBox sMessage
GoTo StartDisplay
ElseIf .Author = "" Then
MsgBox sMessage
GoTo StartDisplay
ElseIf .Keywords = "" Then
MsgBox sMessage
GoTo StartDisplay
ElseIf .Comments = "" Then
MsgBox sMessage
GoTo StartDisplay
Else
.Execute
End If
Else
MsgBox sMessage
GoTo StartDisplay
End If
End With
ActiveDocument.Save

End Sub

It doesn't work in excel because With Dialogs(wdDialogFileSummaryInfo)
is not defined.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


--

Dave Peterson

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 Properties Tab on Doc Save abet_72 Excel Discussion (Misc queries) 5 July 28th 08 08:21 PM
Excel text box properties R Ormerod Excel Discussion (Misc queries) 1 August 4th 07 08:31 AM
Excel Properties Harley New Users to Excel 2 January 19th 06 11:26 PM
Excel properties - 'archive'? Shedlord Excel Discussion (Misc queries) 0 August 2nd 05 05:09 PM


All times are GMT +1. The time now is 02:32 PM.

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

About Us

"It's about Microsoft Excel"