Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have 132 different files that need to have the same text: "FORWARDED
TO PM DD-MM-YYYY" in the comment section in each of the file's property box. I tried to record a macro, but nothing happens in the property comment box. As I enter the information in each file, I have been opening the property box and been cutting and pasting this information, but I was wondering if a macro or VBA code could be written to make it faster and easier and I wouldn't have to open all the property boxes. Can anyone write the macro or code for me? I am a novice, but know how to use the modules. Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kat,
I have 132 different files that need to have the same text: "FORWARDED TO PM DD-MM-YYYY" in the comment section in each of the file's property box. This changes the comments section in each Excel file in folder "c:\Data\" Sub Modifycomments() Dim lCount As Long Dim sFilename As String Dim sPath As String sPath = "c:\data\" ChDrive sPath ChDir sPath sFilename = Dir("*.xls") While sFilename < "" Workbooks.Open sFilename ActiveWorkbook.BuiltinDocumentProperties("Comments ").Value = "FORWARDED TO PM DD-MM-YYYY" ActiveWorkbook.Save ActiveWorkbook.Close False sFilename = Dir() Wend End Sub Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com Member of: Professional Office Developer Association www.proofficedev.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On May 4, 9:37 am, Jan Karel Pieterse wrote:
Hi Kat, I have 132differentfilesthat need to have thesametext: "FORWARDED TO PM DD-MM-YYYY" in thecommentsection in each of thefile's propertybox. This changes the comments section in eachExcelfilein folder "c:\Data\" Sub Modifycomments() Dim lCount As Long Dim sFilename As String Dim sPath As String sPath = "c:\data\" ChDrive sPath ChDir sPath sFilename = Dir("*.xls") While sFilename < "" Workbooks.Open sFilename ActiveWorkbook.BuiltinDocumentProperties("Comments ").Value = "FORWARDED TO PM DD-MM-YYYY" ActiveWorkbook.Save ActiveWorkbook.Close False sFilename = Dir() Wend End Sub Regards, Jan Karel PieterseExcelMVPhttp://www.jkp-ads.com Member of: Professional Office Developer Associationwww.proofficedev.com Wow, thanks for the help. I put it in a module in Excel, but when I get to Workbooks.Open sFilename ActiveWorkbook.BuiltinDocumentProperties("Comments ").Value = "FORWARDED TO PM DD-MM-YYYY it errors out. Where do I store this code? (Could this be my problem)? Does it go into my personal.xls file? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kat,
Wow, thanks for the help. I put it in a module in Excel, but when I get to Workbooks.Open sFilename ActiveWorkbook.BuiltinDocumentProperties("Comments ").Value = "FORWARDED TO PM DD-MM-YYYY it errors out. The code goes into any convenient workbook, in a normal module. personal.xls is fine. But the lines ActiveWorkbook.BuiltinDocumentProperties("Comments ").Value = "FORWARDED TO PM DD-MM-YYYY" should all go on one line, this is just my editor throwing it off with its word wrap. Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com Member of: Professional Office Developer Association www.proofficedev.com |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
WOW! That really works! What a time saver! I couldn't believe it. It
would have taken me forever to do that! Thanks again. I really, really appreciate it!!!!!!! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Kat,
WOW! That really works! What a time saver! I couldn't believe it. It would have taken me forever to do that! Thanks again. I really, really appreciate it!!!!!!! You're welcome! Regards, Jan Karel Pieterse Excel MVP http://www.jkp-ads.com Member of: Professional Office Developer Association www.proofficedev.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Button / Shortcut to extranal file's macro? | Excel Discussion (Misc queries) | |||
Is there a way to enter a comment on a locked cell in Excel? | Excel Worksheet Functions | |||
how to default WritePassword under excel workbook property for any files as long as those files are the offsprings of the parent file | Excel Programming | |||
FORMAT COMMENT TEXT WITH MACRO | Excel Programming | |||
Prompted to convert the file's text encoding... | Excel Discussion (Misc queries) |