Y
yeokphong
Hi, I have two questions for two problems. And this is my first problem.
Below is my code for Date problem.
Set cst = pt.Constants
With pt.ActiveView
For intCnt = 0 To .FieldSets.Count - 1
If .FieldSets(intCnt).BoundField.DataType = 135 Then '135 = date
data type
.FieldSets(intCnt).Fields(0).NumberFormat = "MMM DD YYYY
HH:MM AM/PM"
For intCnt2 = 0 To .FieldSets(intCnt + 1).Fields.Count - 1
.FieldSets(intCnt + 1).Fields(intCnt2).Caption =
Trim(Replace(.FieldSets(intCnt).Fields(0).Caption, "Date", "")) & " " &
..FieldSets(intCnt + 1).Fields(intCnt2).Caption
Next
For intCnt2 = 0 To .FieldSets(intCnt + 2).Fields.Count - 1
If .FieldSets(intCnt + 2).Fields(intCnt2).Caption =
"Days" And .FieldSets(intCnt + 2).Fields(intCnt2).NumberFormat = "dd-mmm"
Then _
.FieldSets(intCnt +
2).Fields(intCnt2).NumberFormat = "dd"
.FieldSets(intCnt + 2).Fields(intCnt2).Caption =
Trim(Replace(.FieldSets(intCnt).Fields(0).Caption, "Date", "")) & " " &
..FieldSets(intCnt + 2).Fields(intCnt2).Caption
Next
intCnt = intCnt + 2
End If
Next
End With
1) For Date format, when view at the pivot report, i don't understand why
it's automatically give me 2 extra diff Date format, that is By Week and By
Month. Then, it's ok for me. And when i use By Month and expand it until Day,
it has show dd-mmm format and i already re-format by writing
..FieldSets(intCnt + 2).Fields(intCnt2).NumberFormat = "dd". It's success.
When i export to Excel file, I'm believe that it's will take whatever format
and data that it's show at pivot to pull into Excel file. But it's not. The
By Month for Day, it's still give me dd-mmm format. May i know got way to
change the format to "dd"? If cann't, may i know why? Does have any article
to support it? Thanks.
2) In Microsoft Office Web Components 9.0, is it cann't tick multiple
selection for filter field at pivot table? Does have any article to support
it behind this reason?
Thank you.
Below is my code for Date problem.
Set cst = pt.Constants
With pt.ActiveView
For intCnt = 0 To .FieldSets.Count - 1
If .FieldSets(intCnt).BoundField.DataType = 135 Then '135 = date
data type
.FieldSets(intCnt).Fields(0).NumberFormat = "MMM DD YYYY
HH:MM AM/PM"
For intCnt2 = 0 To .FieldSets(intCnt + 1).Fields.Count - 1
.FieldSets(intCnt + 1).Fields(intCnt2).Caption =
Trim(Replace(.FieldSets(intCnt).Fields(0).Caption, "Date", "")) & " " &
..FieldSets(intCnt + 1).Fields(intCnt2).Caption
Next
For intCnt2 = 0 To .FieldSets(intCnt + 2).Fields.Count - 1
If .FieldSets(intCnt + 2).Fields(intCnt2).Caption =
"Days" And .FieldSets(intCnt + 2).Fields(intCnt2).NumberFormat = "dd-mmm"
Then _
.FieldSets(intCnt +
2).Fields(intCnt2).NumberFormat = "dd"
.FieldSets(intCnt + 2).Fields(intCnt2).Caption =
Trim(Replace(.FieldSets(intCnt).Fields(0).Caption, "Date", "")) & " " &
..FieldSets(intCnt + 2).Fields(intCnt2).Caption
Next
intCnt = intCnt + 2
End If
Next
End With
1) For Date format, when view at the pivot report, i don't understand why
it's automatically give me 2 extra diff Date format, that is By Week and By
Month. Then, it's ok for me. And when i use By Month and expand it until Day,
it has show dd-mmm format and i already re-format by writing
..FieldSets(intCnt + 2).Fields(intCnt2).NumberFormat = "dd". It's success.
When i export to Excel file, I'm believe that it's will take whatever format
and data that it's show at pivot to pull into Excel file. But it's not. The
By Month for Day, it's still give me dd-mmm format. May i know got way to
change the format to "dd"? If cann't, may i know why? Does have any article
to support it? Thanks.
2) In Microsoft Office Web Components 9.0, is it cann't tick multiple
selection for filter field at pivot table? Does have any article to support
it behind this reason?
Thank you.