+ Reply to Thread
Results 1 to 6 of 6

Macro to set file properties

  1. #1
    Registered User
    Join Date
    03-25-2010
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    26

    Macro to set file properties

    Hi,

    Is it possible to code a macro to set a file's properties in Excel 2010? I want the Macro to change the file's "Title" field to the contents of cell A1.

    Thanks in advance for any help.
    Last edited by fizzy; 06-04-2013 at 11:38 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Macro to set file properties

    Please Login or Register  to view this content.
    for instance
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: Macro to set file properties

    Hi,

    in general:
    Please Login or Register  to view this content.
    and for the title to be the value in cell A1 of worksheet "Sheet1"

    Please Login or Register  to view this content.
    Last edited by tehneXus; 06-03-2013 at 04:09 PM. Reason: To slow, sth is weird with the refresh here ...
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  4. #4
    Registered User
    Join Date
    03-25-2010
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Macro to set file properties

    thank you both for the help, I appreciate it!

  5. #5
    Registered User
    Join Date
    03-25-2010
    Location
    Scotland
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Macro to set file properties

    Hi,

    This worked fine for me: activeworkbook.BuiltinDocumentProperties("Title") = "your title"

    However when I try to use a specific cell in my workbook it doesn't seem to do anything (no error is returned, but the title remains blank. Can anyone confirm whether "ThisWorkbook.BuiltinDocumentProperties("title") = Worksheets("Sheet1").Range("A1").Value" is correct? I've tried replacing "ThisWorkbook" with "ActiveWorkbook" instead, but still no luck.

    If it makes any difference the text I want to use is merged across A1-D1, I've tried the range as "A1" and also "A1:D1" but no luck.

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Macro to set file properties

    the code is correct-activeworkbook is the active workbook whereas thisworkbook is the workbook containing the code

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1