R
rs0905
Here's the mystery:
I have code that creates a series of worksheets in an Excel Workbook, one
for each of a team of employees. The code typically creates 5-6 worksheets
for employees that are specified by the db user. For about 1/2 of the db
users, this process works without a hitch. For the other half of the users,
it overwrites the same worksheet over and over instead of creating new ones
for each person, so they are left with only one worksheet for the last person
on their list. I am not in the office, but the IT support at the office has
confirmed that they are all running the same version of MS Office. Here is
the code that creates the worksheets (this is within a Do Loop and repeats
for each employee specified):
Dim xlBook, xlSheet, xlSheet2
Set xlBook = appExcel.Workbooks.Open(STORE_PATH & "store.xls", , True)
Set xlSheet = xlBook.Worksheets(1)
Set xlSheet2 = xlBook.Worksheets("template")
' ' ' the above is set before the loop. the following is within the loop '
' '
xlSheet2.Activate
xlSheet2.Copy Before:=Worksheets("Template")
Set xlSheet = ActiveWorkbook.Worksheets("Template (2)") ' ' ' this is the
copy ' ' '
xlSheet.Activate
xlSheet.Name = strCounselor
Does anyone know why this would work for some users but not for others??
I have code that creates a series of worksheets in an Excel Workbook, one
for each of a team of employees. The code typically creates 5-6 worksheets
for employees that are specified by the db user. For about 1/2 of the db
users, this process works without a hitch. For the other half of the users,
it overwrites the same worksheet over and over instead of creating new ones
for each person, so they are left with only one worksheet for the last person
on their list. I am not in the office, but the IT support at the office has
confirmed that they are all running the same version of MS Office. Here is
the code that creates the worksheets (this is within a Do Loop and repeats
for each employee specified):
Dim xlBook, xlSheet, xlSheet2
Set xlBook = appExcel.Workbooks.Open(STORE_PATH & "store.xls", , True)
Set xlSheet = xlBook.Worksheets(1)
Set xlSheet2 = xlBook.Worksheets("template")
' ' ' the above is set before the loop. the following is within the loop '
' '
xlSheet2.Activate
xlSheet2.Copy Before:=Worksheets("Template")
Set xlSheet = ActiveWorkbook.Worksheets("Template (2)") ' ' ' this is the
copy ' ' '
xlSheet.Activate
xlSheet.Name = strCounselor
Does anyone know why this would work for some users but not for others??