Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default File Properties Code

How can I manipulate the File Properties for a Workbook. I tried recording
a macro following the keystrokes File | Properties and then entered data for
Title, Subject and Author but nothing appeared in the macro.

I'm trying to use the subject field to record a version number and date for
the model and transfer this exact data to a splash screen. My thought is
I'd entered the current version number and date in a cell which would be
transferred to the File | Properties when the workbook is saved and
transfers to the splash screen when the workbook is opened.

Thanks for the help.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default File Properties Code

Look at document properties and builtindocument properties

See Chip Pearson's page on this topic:

http://www.cpearson.com/excel/docprop.htm

although not shown as a property in the object browser (or by intellisense),
this works



? activeworkbook.subject
This is the subject

Activeworkbook.Subject = "My new subject"
? activeworkbook.Subject
My new subject

Tested in Excel 2000.

--
Regards,
Tom Ogilvy

"John Michl" wrote in message
...
How can I manipulate the File Properties for a Workbook. I tried

recording
a macro following the keystrokes File | Properties and then entered data

for
Title, Subject and Author but nothing appeared in the macro.

I'm trying to use the subject field to record a version number and date

for
the model and transfer this exact data to a splash screen. My thought is
I'd entered the current version number and date in a cell which would be
transferred to the File | Properties when the workbook is saved and
transfers to the splash screen when the workbook is opened.

Thanks for the help.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default File Properties Code

Awesome. Worked like a charm. Thank's Tom.

- John

"Tom Ogilvy" wrote in message
...
Look at document properties and builtindocument properties

See Chip Pearson's page on this topic:

http://www.cpearson.com/excel/docprop.htm

although not shown as a property in the object browser (or by

intellisense),
this works



? activeworkbook.subject
This is the subject

Activeworkbook.Subject = "My new subject"
? activeworkbook.Subject
My new subject

Tested in Excel 2000.

--
Regards,
Tom Ogilvy

"John Michl" wrote in message
...
How can I manipulate the File Properties for a Workbook. I tried

recording
a macro following the keystrokes File | Properties and then entered data

for
Title, Subject and Author but nothing appeared in the macro.

I'm trying to use the subject field to record a version number and date

for
the model and transfer this exact data to a splash screen. My thought

is
I'd entered the current version number and date in a cell which would be
transferred to the File | Properties when the workbook is saved and
transfers to the splash screen when the workbook is opened.

Thanks for the help.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default File Properties Code

Spoke a little too soon. It works like a charm except for the "Company"
Property. The author updates fine but I receive a run time 438 - object
doesn't support this property" error on the Company statement. Is there a
different name for this proporty? I created a list of names using the code
in example 2. Thanks.


EXAMPLE 1
Private Sub Workbook_Open()

ActiveWorkbook.Author = "John A. Michl"
ActiveWorkbook.Company = "John Michl Consulting"

End Sub

EXAMPLE 2
Sub GetProps()
rw = 1
Worksheets(1).Activate
For Each p In ActiveWorkbook.BuiltinDocumentProperties
Cells(rw, 2).Value = p.Value
rw = rw + 1
Next
End Sub


"John Michl" wrote in message
...
Awesome. Worked like a charm. Thank's Tom.

- John

"Tom Ogilvy" wrote in message
...
Look at document properties and builtindocument properties

See Chip Pearson's page on this topic:

http://www.cpearson.com/excel/docprop.htm

although not shown as a property in the object browser (or by

intellisense),
this works



? activeworkbook.subject
This is the subject

Activeworkbook.Subject = "My new subject"
? activeworkbook.Subject
My new subject

Tested in Excel 2000.

--
Regards,
Tom Ogilvy

"John Michl" wrote in message
...
How can I manipulate the File Properties for a Workbook. I tried

recording
a macro following the keystrokes File | Properties and then entered

data
for
Title, Subject and Author but nothing appeared in the macro.

I'm trying to use the subject field to record a version number and

date
for
the model and transfer this exact data to a splash screen. My thought

is
I'd entered the current version number and date in a cell which would

be
transferred to the File | Properties when the workbook is saved and
transfers to the splash screen when the workbook is opened.

Thanks for the help.








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default File Properties Code

Activeworkbook.BuiltinDocumentProperties("Company" ).Value


Private Sub Workbook_Open()

ActiveWorkbook.Author = "John A. Michl"
ActiveWorkbook.BuiltinDocumentProperties("Company" ).Value _
= "John Michl Consulting"
End Sub


It looks like it only supports Title, Author and Subject directly (I didn't
do extensive testing).

--
Regards,
Tom Ogilvy


"John Michl" wrote in message
...
Spoke a little too soon. It works like a charm except for the "Company"
Property. The author updates fine but I receive a run time 438 - object
doesn't support this property" error on the Company statement. Is there a
different name for this proporty? I created a list of names using the

code
in example 2. Thanks.


EXAMPLE 1
Private Sub Workbook_Open()

ActiveWorkbook.Author = "John A. Michl"
ActiveWorkbook.Company = "John Michl Consulting"

End Sub

EXAMPLE 2
Sub GetProps()
rw = 1
Worksheets(1).Activate
For Each p In ActiveWorkbook.BuiltinDocumentProperties
Cells(rw, 2).Value = p.Value
rw = rw + 1
Next
End Sub


"John Michl" wrote in message
...
Awesome. Worked like a charm. Thank's Tom.

- John

"Tom Ogilvy" wrote in message
...
Look at document properties and builtindocument properties

See Chip Pearson's page on this topic:

http://www.cpearson.com/excel/docprop.htm

although not shown as a property in the object browser (or by

intellisense),
this works



? activeworkbook.subject
This is the subject

Activeworkbook.Subject = "My new subject"
? activeworkbook.Subject
My new subject

Tested in Excel 2000.

--
Regards,
Tom Ogilvy

"John Michl" wrote in message
...
How can I manipulate the File Properties for a Workbook. I tried
recording
a macro following the keystrokes File | Properties and then entered

data
for
Title, Subject and Author but nothing appeared in the macro.

I'm trying to use the subject field to record a version number and

date
for
the model and transfer this exact data to a splash screen. My

thought
is
I'd entered the current version number and date in a cell which

would
be
transferred to the File | Properties when the workbook is saved and
transfers to the splash screen when the workbook is opened.

Thanks for the help.










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
File properties Radek Simek[_2_] Excel Worksheet Functions 0 December 10th 07 03:45 PM
File Properties TerryTutor Excel Discussion (Misc queries) 2 August 30th 07 06:06 PM
File Properties ALEX Excel Discussion (Misc queries) 1 February 8th 07 02:47 PM
File Properties Annie Excel Discussion (Misc queries) 1 April 20th 06 08:27 PM
Setting Font properties in Code clears Undo list Lorin Excel Programming 2 July 10th 03 09:49 PM


All times are GMT +1. The time now is 07:55 AM.

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"