It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

saving an excel file

Moderator: dafunkymunky

saving an excel file

Postby jblues on Tue May 03, 2011 11:16 am

Can anyone help me with this code?
It brings up the user prompt "Do you want to save changes to the file" rather than savinng the changes with the oBook.Save() command.

Private Sub CompeletionWorksheet4()
Dim file1 As String = "C:\Libraries\Documents\requestlog.xls"

If System.IO.File.Exists(file1) Then _
System.IO.File.Delete(file1)
Dim nowtime = TimeValue(Now)
Dim nowdate = DateValue(Now)


Dim oExcel As New Object
Dim oBook As Object
Dim oSheet As Object
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.open(file1)
oSheet = oBook.ActiveSheet
oSheet.Range("O4").Value = nowdate

oBook.Save()
oExcel.Quit()


End Sub
jblues
 
Posts: 13
Joined: Tue May 03, 2011 11:08 am

Who is online

Users browsing this forum: No registered users and 2 guests