467,168 Members | 988 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,168 developers. It's quick & easy.

Modify the excel sheet

100+
hello expert
i have a programe in which i want to modify or add new records in excel sheet
but it opened read only and when ever i want to insert the record it give the message that give new name to save the changes
is there any idea to modify the excel sheet my code is

Set x1 = CreateObject("Excel.Application")
x1.Workbooks.Open ("c:\var\var2.xls")
x1.Visible = True
x1.Worksheets(1).Cells(10, 5) = "hello"
'x1.ActiveWorkbook.Save
Set xl = Nothing
Unload Me
thanks
Nov 23 '07 #1
  • viewed: 1124
Share:
1 Reply
Hi,

may be this code will help..
first add refrence for Excel

Dim objXL As Excel.Application
Dim objWB As Excel.Workbook
Dim objWS As Excel.Worksheet
Set objXL = New Excel.Application
Set objWB = objXL.Workbooks.Open("C:\Documents and Settings\raj\Desktop\Value Card\Appreciation.xls")
Set objWS = objWB.Worksheets(1)
With objWS
.Cells(17, 6) = Combo2.Text
.Cells(20, 6) = Text1.Text
objWB.Save
objWB.Close
End With
Set objWS = Nothing
Set objWB = Nothing
Nov 27 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by Allison Bailey | last post: by
12 posts views Thread by elziko | last post: by
3 posts views Thread by implicate_order | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.