CustomDocumentProperties
One way, taking the hidden name example
On Error Resume Next
For Each wb In Workbooks
Set nm = Nothing
Set nm = wb.Names("Bulk")
If Not nm Is Nothing Then
If Len(s) Then s = s & ","
s = s & wb.Name
Else
Err.Clear
End If
Next
On Error GoTo 0 ' or resume normal error hanfdling
v = Split(s, ",")
If UBound(v) -1 Then
' look at the string s or the array v
End If
Other ways, in the loop add "bulk" wb's to a collection (wb.name or as the
object), or to an array, etc
Regards,
Peter T
"Michelle" wrote in message
...
Thanks Peter but how can I tell if more than one spreadsheet is open or
not?
"Peter T" wrote:
There are various ways to "mark" a workbook, one way
s = "whatever" ' eg wb.name
With wb.Names.Add("Bulk", s)
..Visible = False ' hide from user
End With
On Error Resume Next
For Each wb In Workbooks
Set nm = Nothing
Set nm = wb.Names("Bulk")
If Not nm Is Nothing Then
MsgBox wb.Name
' exit for etc
Else
Err.Clear
End If
Next
or maybe Customdocument properties
or perhaps assign say the prefix to the workbook's title
wb.Title = "Bulk_abc"
if instr(wb.title, "Bulk") = 1 then
Regards,
Peter T
"Michelle" wrote in message
...
Hello,
I want to make sure the user has only one bulk load spreadsheet open at
a
time.I am trying to check this using the CustomDocumentProperties for
spreadsheet name. I had the following code but if the user saves the
spreadsheet under a new name this code will not see it. Can you help
me?
For intI = 1 To Workbooks.count
If Workbooks.Item(intI).Name = "Document Control Markup.xls" Or
_
Workbooks.Item(intI).Name = "Document Control Vendor
Submittal.xls"
Or _
Workbooks.Item(intI).Name = "PLM_Author.xls" Then
blnOtherBulkLoadSSOpen = True
End If
Next intI
If blnOtherBulkLoadSSOpen Then
MsgBox "You cannot have MORE THAN ONE Bulk Load Spreadsheet open
at
the same time!", _
vbCritical, "CLOSE OTHER INSTANCES OF BULK LOAD SPREADSHEETS"
|