Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a situation here. With a macro I am able to update the cell of a test spreadsheet (.xlsx).
But the same macro fails to update the original data sheet(.xlsm) I should need to update.
Am sorry that I can't share the original spreadsheet here.
What might be the reasons that blocking the update.?? Please help.
Below is the macro.
function a
set objExcel = CreateObject("Excel.application")
objExcel.DisplayAlerts = False
set objWB = objExcel.Workbooks.Open("path\spreadhsheet.xlsx")
With objWB.Worksheets(1)
.Activate
.Cells(1,1).Value = "12/25/2016"
End With
objWB.save
objWB.close
set objSheet = Nothing
set objWB = Nothing
set objExcel = Nothing
end function
Thank you so much Karthik for your time and advice. Finally got the issue.
Here am using With objWB.Worksheets(1).
Maybe in the original spreadsheet, the order of the sheets is changed and the sheet am trying is not sheet1 may be.
When I tried giving the name With objWB.Worksheets("******"). It worked fine.
Hi Shiva,
Do you think it has something to do with folder privileges? Do you have read/write access to the folder in which the original xlsm is present?
Yes Karthik, Actually both test and original files are present in same folder.
Ok. A couple of things you could verify:
1. Is the xlsm password-protected?
2. You could try to see if you at all able to update a xlsm file (a second file that is of the xlsm type)
Thank you so much Karthik for your time and advice. Finally got the issue.
Here am using With objWB.Worksheets(1).
Maybe in the original spreadsheet, the order of the sheets is changed and the sheet am trying is not sheet1 may be.
When I tried giving the name With objWB.Worksheets("******"). It worked fine.