By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,988 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,988 IT Pros & Developers. It's quick & easy.

Modify the excel sheet

100+
P: 198
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
Share this Question
Share on Google+
1 Reply


P: 6
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.