日期:2014-05-17  浏览次数:20868 次

已把a定义成a=Server.Mappath("csv") 虚拟路径,但运行后还是说找不到" "文件,怎么变成物理路径了?
asp代码如下
set   Myobj=server.CreateObject( "projectexcel.classexcel ")  
Myobj.strOutPath=Server.Mappath( "csv ")   & "\ "   &   cstr(Formatdatetime(Now,   1))   &   ".xls "  
(注:strOutPath是原来用vb写的dll里的,在vb调试的时候曾被用过,是物理路径,但vb调试的语句不在dll里,是独立的)
vb代码
Dim   i,   j   As   Integer
Public   xlApp   As   Excel.Application
Public   xlBook   As   Excel.Workbook
Public   xlSheet   As   Excel.Worksheet

Public   theOutPath                                       As   String
Public   Property   Let   strOutPath(s   As   Variant)
        theOutPath   =   s
End   Property
Private   Property   Get   getOutPath()
        getOutPath   =   theOutPath
End   Property

Public   Function   aspexcel(ByVal   SQLStr   As   String)   As   Boolean
Set   cnn   =   New   ADODB.Connection
cnn.Open   =   "Provider   =SQLOLEDB;Initial   Catalog=e;Data   Source=2号;UID=sa;Pwd=123456 "
Set   rs   =   New   ADODB.Recordset
Set   cmd   =   New   ADODB.Command
rs.Open   SQLStr,   cnn
        Set   xlApp   =   New   Excel.Application
                xlApp.DisplayAlerts   =   False
                xlApp.Visible   =   False     'changed
  Set   xlBook   =   xlApp.Workbooks.Open(getOutPath)
              Set   xlSheet   =   xlBook.Sheets(1)
             
        For   j   =   0   To   rs.Fields.Count   -   1  
                xlSheet.Cells(1,   j   +   1)   =   rs.Fields(j).Name
        Next   j
For   i   =   1   To   rs.RecordCount
                  rs.MoveFirst       'move   down
        While   Not   rs.EOF
                For   j   =   1   To   rs.Fields.Count
                        xlSheet.Cells(i   +   1,   j)   =   rs.Fields(j   -   1).Value    
                Next   j
                rs.MoveNext
                Wend
        Next   i
   
        xlSheet.Range( "A2 ").CopyFromRecordset   rs
       
rs.Close
cnn.Close
  'xlBook.SaveAs   (getOutPath)  
      xlBook.Close
        xlApp.Quit
    &nb