Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
laddu_927
Specialist
Specialist

Macro to update excel cell.

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

1 Solution

Accepted Solutions
laddu_927
Specialist
Specialist
Author

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.

View solution in original post

4 Replies
karthiksrqv
Partner
Partner

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?

laddu_927
Specialist
Specialist
Author

Yes Karthik, Actually both test and  original files are present in same folder.

karthiksrqv
Partner
Partner

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)

laddu_927
Specialist
Specialist
Author

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.

View solution in original post