Sub Initialize
 Dim ws As New notesuiworkspace
 Dim ss As New notessession
 Dim db As notesdatabase
 Dim view As notesview
 Dim doc As notesdocument
 Dim files As Variant
 Dim v As Variant
 Dim excelApplication As Variant
 Dim excelWorkbook As Variant
 Dim excelsheet As Variant
 Dim count As Integer
 files = ws.SaveFileDialog( False,"File name",, "c:\", "ISSCYellowPage.xls")
 If Not(Isempty(files)) Then 
  count=0
  Set db=ss.currentdatabase
  Set view=db.getview("MList_All")
  
  Set excelApplication=CreateObject("Excel.Application")
  
  Set excelWorkbook = excelApplication.Workbooks.Add
  Call excelWorkbook.SaveAs(files(0))
  
  Set excelsheet=excelWorkbook.Sheets.add
  excelsheet.name="ISSC Yellow Page"
  
  excelSheet.Cells(1,1).Value="Name"
  excelSheet.Cells(1,2).Value="Serial"
  excelSheet.Cells(1,3).Value="Employee Type"
  excelSheet.Cells(1,4).Value="Notes ID"
  excelSheet.Cells(1,5).Value="TelLine"
  excelSheet.Cells(1,6).Value="External"
  excelSheet.Cells(1,7).Value="Location"
  excelSheet.Cells(1,8).Value="Last Update Date"
  excelSheet.Cells(1,9).Value="Band"
  excelSheet.Cells(1,10).Value="Company Name"
  excelSheet.Cells(1,11).Value="Japanese Name"
  excelSheet.Cells(1,12).Value="Japanese Name(FURIGANA)"
  excelSheet.Cells(1,13).Value="Assignment"
  excelSheet.Cells(1,14).Value="Current Assignment"
  excelSheet.Cells(1,15).Value="Group"
  excelSheet.Cells(1,16).Value="Current Project Group"
  excelSheet.Cells(1,17).Value="Business Area"
  excelSheet.Cells(1,18).Value="Fixed Member"
  excelSheet.Cells(1,19).Value="STFS"
  excelSheet.Cells(1,20).Value="STFS Location"
  excelSheet.Cells(1,21).Value="STFS Period"
  excelSheet.Cells(1,22).Value="EATSO ID"
  excelSheet.Cells(1,23).Value="Comment"
  
  Set doc=view.getfirstdocument
  While Not doc Is Nothing
   excelSheet.Cells(count+2,1).Value=doc.PYName(0)
   excelSheet.Cells(count+2,2).Value=doc.Serial(0)
   excelSheet.Cells(count+2,3).Value=doc.type(0)
   v=Evaluate("@Name([Abbreviate];"""+doc.NotesID(0)+""")", doc)
   excelSheet.Cells(count+2,4).Value= v(0)
   excelSheet.Cells(count+2,5).Value=doc.Extension(0)
   excelSheet.Cells(count+2,6).Value=doc.Extension_1(0)
   excelSheet.Cells(count+2,7).Value=doc.location(0)
   excelSheet.Cells(count+2,8).Value=doc.updateTime(0)
   excelSheet.Cells(count+2,9).Value=doc.band(0)
   excelSheet.Cells(count+2,10).Value=doc.companyName(0)
   excelSheet.Cells(count+2,11).Value=doc.kanji(0)
   excelSheet.Cells(count+2,12).Value=doc.frgn(0)
   excelSheet.Cells(count+2,13).Value=doc.assignment(0)
   excelSheet.Cells(count+2,14).Value=doc.assignment_1(0)
   excelSheet.Cells(count+2,15).Value=doc.IGAJGroup(0)
   excelSheet.Cells(count+2,16).Value=doc.IGAJGroup_1(0)
   excelSheet.Cells(count+2,17).Value=doc.BArea(0)
   excelSheet.Cells(count+2,18).Value=doc.FMember(0)
   excelSheet.Cells(count+2,19).Value=doc.STFS(0)
   excelSheet.Cells(count+2,20).Value=doc.STFSLocation(0)
   excelSheet.Cells(count+2,21).Value=Format(doc.Start(0),"mm-dd-yyyy")+Format(doc.End(0),"mm-dd-yyyy")
   excelSheet.Cells(count+2,22).Value=doc.EatsoID(0)
   excelSheet.Cells(count+2,23).Value=doc.Comment(0)
   Print ("Export  "+doc.PYName(0))
   count=count+ 1  
   Set doc=view.getnextdocument(doc)
  Wend
  excelWorkbook.save
  excelWorkbook.close(False)
  excelApplication.Quit
  Set excelApplication=Nothing  
 End If
 
End Sub
posted on 2005-02-02 08:49  James Wong   阅读(888)  评论(1)    收藏  举报