using a form to add to File>Properties in Word 
Author Message
 using a form to add to File>Properties in Word

Hi

I am trying to set up a form accessbible as a macro from Word, where
people can enter Custom properties and the values associated with them.
The full script is added below.

It is the line:

ActiveDocument.CustomDocumentProperties.Add Name:="Product",
Value:=UserForm1.Product.Value

That gives me an error. What I am trying to do is to create a custom
Field "Product" where the value in the textbox of the form will be used
as the value of a custom file properties field, called "Product".

Does anyone knows how to use Visual Basic to add a custom field + its
value in File>Properties?

Please note I am not a VB expert at all - a detailed explanation or a
line that betters the one above would be most welcome.

Thanks

Hugo  

Private Sub SubmitButton_Click()

Dim foundProduct As Boolean

foundProduct = False

For Each p In ActiveDocument.CustomDocumentProperties
    If p.Name = "Product" Then
            p.Value = UserForm1.Product.Value
            foundProduct = True
        End If
        If p.Name = "Subsystem" Then
            p.Value = UserForm1.Subsystem.Value
            foundSubsystem = True
        End If
        If p.Name = "Abstract" Then
            p.Value = UserForm1.Abstract.Value
            foundAbstract = True
        End If
      Next p

If foundProduct = False Then
    ActiveDocument.CustomDocumentProperties.Add Name:="Product",
Value:=UserForm1.Product.Value
    End If

UserForm1.Hide

End Sub

Private Sub UserForm_Click()

End Sub

--
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics
39 Fairway, Nedlands Western Australia 6009
Tel: 9284 8442

Web: http://www.*-*-*.com/



Mon, 31 Mar 2003 09:19:49 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. <<VB3 HELP>>HOW DO YOU ADD WAV FILES TO VB3 FORMS

2. Adding a link on a VB form to a Word file

3. Database Form -> Word Form

4. Add new properties to <Input> tag

5. Adding Forms and external code to Word / Office applications

6. Any help??>>>Re: add custom icon to button outlook commandbar in dotnet

7. >>>> HELP WITH RUNTIME FILES

8. Add a button to a CommandBar in Word using wsh

9. Add a button to a CommandBar in Word using wsh

10. Using a main form to control the edit properties of a subform using VBA

11. using The Shell Command >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

12. Create custom control in form using code (code wizard adding ocx to form)

 

 
Powered by phpBB® Forum Software