Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Use Custom Document Property to identify xls files not yet process

I have a macro that goes through each spreadsheet in a folder and formats the
sheet.

I'd like to have the code first check to see if there is a Custom Document
Property and if so if it is set to True (this will tell the macro to close
the file and move to the next one - the current one has already been
formatted).

If it doesn't find the property (or if the property is set to false) it
would format the file, then add the property (or set it to true).

Can this be done via VB?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Use Custom Document Property to identify xls files not yet process

See:

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


--
Gary''s Student - gsnu200747


"Robert_L_Ross" wrote:

I have a macro that goes through each spreadsheet in a folder and formats the
sheet.

I'd like to have the code first check to see if there is a Custom Document
Property and if so if it is set to True (this will tell the macro to close
the file and move to the next one - the current one has already been
formatted).

If it doesn't find the property (or if the property is set to false) it
would format the file, then add the property (or set it to true).

Can this be done via VB?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Use Custom Document Property to identify xls files not yet process

On Sep 27, 3:16 pm, Robert_L_Ross
wrote:
I have a macro that goes through each spreadsheet in a folder and formats the
sheet.

I'd like to have the code first check to see if there is a Custom Document
Property and if so if it is set to True (this will tell the macro to close
the file and move to the next one - the current one has already been
formatted).

If it doesn't find the property (or if the property is set to false) it
would format the file, then add the property (or set it to true).

Can this be done via VB?

Thanks!


Hello Robert,

Yes, it can. To check if the Workbook has any custom properties use
this code...

Cnt = ThisWorkbook.CustomDocumentProperties

If the Cnt = 0 then there are no Custom Document Properties.

To set a Custom Document Property use this code...

Sub AddCustomProperty()

Dim CustomProp As Object

Set CustomProp = ThisWorkbook.CustomDocumentProperties

With CustomProp
.Add Name:="User Name", LinkToContent:=False,
Type:=msoPropertyTypeString, Value:="Leith Ross"
End With

End Sub

Other TYPE constants a msoPropertyTypeBoolean, msoPropertyTypeDate,
msoPropertyTypeFloat, msoPropertyTypeNumber, or msoPropertyTypeString.

Sincerely,
Leith Ross

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
how to default WritePassword under excel workbook property for any files as long as those files are the offsprings of the parent file George Excel Programming 0 October 5th 06 04:14 PM
Putting the document number custom property in workbook DRK Excel Programming 1 June 13th 06 12:10 PM
Can you link a custom property to an Excel custom header text? LouErc Setting up and Configuration of Excel 0 November 8th 05 04:58 PM
Process excel files, suppress alerts mwazir Excel Programming 4 June 2nd 04 02:23 PM
Identify Document Being opened from an Add-In using Auto_Open? Yo Excel Programming 2 January 15th 04 09:38 PM


All times are GMT +1. The time now is 07:30 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"