Share this content
0
1087

vba script

vba script

Didn't find your answer?

Search AccountingWEB

I wish to automate the population of the field called Title in the workbook's File Properties. For the avoidance of doubt I mean click on file > properties > title.

The narrative I wish to populate is already in cell B8 of a sheet called "header". So my long hand, non vba route is to

1) click on sheet "header"

2) click on cell B8 and ctrl+C

3) click File > Properties > Title

4) ctrl+V

5) return to main screen

This is my novice attempt...

Sub UpdateWorkbookPropertiesTitle()
'
    Sheets("header").Select
    Range("B8").Select
    Selection.Copy
    Environ("Title") = Value
    Application.CutCopyMode = False
End Sub

I can see this will not work, but don't know how to fix. Any charitable assistance would be gratefully received.

Many thanks for reading this.

PS I intend to place this in a loop to run this routine over a series of workbooks, but I should be OK to do that part.

Replies (3)

Please login or register to join the discussion.

avatar
By 3569787
03rd May 2016 16:27

Meta Data no spreadsheet data

.

Thanks (1)
By bro0010
10th Sep 2014 19:23

This is the correct syntax

All on one line:

ThisWorkbook.BuiltinDocumentProperties("Title").Value = Sheets("header").Range("B8").Value

I hope this is enough to get you going.

Warm regards,

Ian

Onion Reporting Software Ltd

www.onionrs.co.uk

Sage reporting packs in Excel to go

Thanks (3)
Replying to lionofludesch:
avatar
By mung1
11th Sep 2014 09:03

Thank you

Ian

This works for me and so most helpful.

Many, many thanks.

Mike

Thanks (0)
Share this content