Save to File

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: wssparky (ws_at_sparky.com)
Date: 05/22/04


Date: Sat, 22 May 2004 14:02:05 -0700

I have a code that when run will save the results to a file "C:Time
Sheets".
But instead it saves to "My Documents".
Below is the code.
Where did I go wrong ?
Thanks for any help !
_________________________________________________________
Private Sub Form_Load()
         Dim oLable As String
         Dim FileNamePath As String
         Dim FileName As String
         Dim Sheet1 As Excel.Worksheet
         Dim sFile As String
         Dim xls As String
         Dim UpdateMain*** As XlRunAutoMacro
         
         FileName = "TimeSheetMain.xls"
         FileNamePath = "C:\Time Clock\TimeSheetMain.xls"
         xls = ".xls"
         LableDate.Caption = Format(Date, "mm.dd.yy")
         oLable = LableDate.Caption
         sFile = oLable + xls
         
          
'Call Excel ***
    Set m_XLApp = Excel.Application
    m_XLApp.Visible = False
    Set m_XLWorkbook = m_XLApp.Workbooks.Open (FileNamePath,
UpdateLinks:=3)
    m_XLWorkbook.RunAutoMacros Which:=xlAutoOpen
    m_XLWorkbook.RunAutoMacros Which:=xlAutoActivate
    m_XLApp.DisplayAlerts = False ' suppress warning messages
    m_XLWorkbook.Sheets().Select
          
    m_XLWorkbook.SaveAs Format("Time *** for " + sFile, "C:Time
Sheets")

    m_XLWorkbook.Close
    Set m_XLWorkbook = Nothing

End Sub
_______________________________________________________

Thanks for the help.
wssparky

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Quantcast