Add an invisible comment

W

Warrio

Hello!

Sorry for the previous post in French...

I'm wondering if it is possible with VBA to add a comment to a new document
created in with code as well.
With MsAccess, there is for each control, a property "Tag" that allows to
add any string

I unfortunately cannot add a line into one of the document's pages (even in
small and in white font) because it would change the general layout of the
document.

and because it is a new document, I cannot give it a new variable and then
set it...

Thanks for any suggestion
 
J

Jonathan West

Warrio said:
Hello!

Sorry for the previous post in French...

I'm wondering if it is possible with VBA to add a comment to a new
document created in with code as well.
With MsAccess, there is for each control, a property "Tag" that allows to
add any string

I unfortunately cannot add a line into one of the document's pages (even
in small and in white font) because it would change the general layout of
the document.

and because it is a new document, I cannot give it a new variable and then
set it...

Thanks for any suggestion

You can add a custom document property, by adding to the
CustomDocumentProperties collection of the document, or you can add a
document variable, by adding to the Variables collection of the document.
 
W

Warrio

Hi Jonathan!

Thanks for your response,

but how do you add a new variable in document that is created automatically?
I'll need to generate have a code that writes code inside the new
document... I know how to do it manually but I won't be there when the user
will click on the button to create the document...

also there is a place into the properties of the document (File menu,
Properties) but I couldn't find the direct VBA command to set it.

Thanks again
 
J

Jonathan West

Warrio said:
Hi Jonathan!

Thanks for your response,

but how do you add a new variable in document that is created
automatically? I'll need to generate have a code that writes code inside
the new document... I know how to do it manually but I won't be there when
the user will click on the button to create the document...

also there is a place into the properties of the document (File menu,
Properties) but I couldn't find the direct VBA command to set it.

Thanks again

Look up the Variables collection in the VBA Help - there is a code example.
Similarly, if you decide to use a custom document property, look up the
DocumentProperties collection in VBA help. Both collections have an Add
method that allows you to create a new variable or property.
 
W

Warrio

Thanks agiain!! it works perfectly now!

Jonathan West said:
Look up the Variables collection in the VBA Help - there is a code
example. Similarly, if you decide to use a custom document property, look
up the DocumentProperties collection in VBA help. Both collections have an
Add method that allows you to create a new variable or property.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
 
W

Warrio

if it could help someone, here is the syntax...

myDoc.CustomDocumentProperties.Add Name:="CommentName", Value:="coment
balabla", Type:=msoPropertyTypeString
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top