Kill the excel process by using the below code
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'EXCEL.EXE'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
On Sat, Oct 12, 2013 at 11:29 AM, Vikas Thange <[email protected]>wrote:
> Hi Omprakash, please ignore my previous incomplete mail.
> There can be many reason for this situation...
>
> 1. Before running make sure all excel are closed..
> Solution: Use task manager to terminate all excel.exe files. or you
> can execute command "taskkill /f /im excel.exe"
> 2. In scripting please make sure you are disabling the alerts (Do you want
> to override? Dialog)
> Solution:
> Add line
> msXl.DisplayAlerts = false 'Before
> "MsXl.Workbooks.Close"
> 3. Please make sure the Excel.exe is terminated after test execution
> (check it via task manager -> "processes" for XP, task manager -> "Details"
> for Win7/win8
>
> I hope this will work for you.
> Thanks.
> Vikas
>
>
> On Sat, Oct 12, 2013 at 9:52 PM, Vikas Thange <[email protected]>wrote:
>
>> Hi Omprakash,
>> There can be many reason for this situation...
>>
>> 1. Before running make sure all excel are closed..
>> Solution: Use task manager to terminate all excel.exe files. or you
>> can execute command "taskkill /f /im excel.exe"
>> 2. In scripting please make sure you are disabling the alerts (Do you
>> want to override? Dialog)
>> Solution:
>> "MsXl.Workbooks.Close"
>>
>>
>> On Fri, Oct 11, 2013 at 4:24 AM, Ganesh muralidharan <[email protected]
>> > wrote:
>>
>>> can you try putting below statement after creation of excel object
>>> MsXl.DisplayAlerts = False
>>>
>>>
>>> Please use a SaveAs to save the file which was opened by you
>>> MsXl.ActiveWorkbook.SaveAs C<filename>
>>>
>>> Put below code at the end
>>> MsXl.Workbooks.Close
>>> MsXl.[Quit]
>>>
>>> On Thu, Oct 10, 2013 at 2:02 AM, Omprakash P <[email protected]>wrote:
>>>
>>>> But again it 's Saving as read only unable to delete the file by manual
>>>> .
>>>>
>>>>
>>>> On Wednesday, October 9, 2013 3:24:15 PM UTC+5:30, Omprakash P wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I wrote code to insert data in Cells Through QTP
>>>>> After Saving the document it is asking like already File Exist you
>>>>> want to replace it like that..
>>>>> After Saving the file it saved as read only.
>>>>> I need like this
>>>>> 1.After Saving it should not ask as file already exists like that
>>>>> 2.It Should be open at that time should not show as read only like
>>>>> that.
>>>>>
>>>>> I wrote bellow code
>>>>> ShtPath=Datatable.GetSheet("**Global").GetParameter(1).**ValueByRow(1)
>>>>> ''
>>>>> Set MsXl=CreateObject("Excel.**Application")
>>>>> Set Mswk=MsXl.Workbooks.Open(**ShtPath)
>>>>> Set MsRes=Mswk.Worksheets("**Results")
>>>>> MsRes.Cells(2,1)="Login Form "
>>>>> dateval=TimeValue(Now)
>>>>> MsRes.Cells(2,3)=dateval
>>>>>
>>>>> Mswk.Save
>>>>>
>>>>> Thanking you
>>>>> Om Prakash
>>>>>
>>>> --
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>>> group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "QTP - HP Quick Test Professional - Automated Software Testing"
>>>> group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>>
>>>
>>> Ganesh Muralidharan
>>> 'God Never Forgets'
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>> group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "QTP - HP Quick Test Professional - Automated Software Testing"
>>> group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
> --
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "QTP - HP Quick Test Professional - Automated Software Testing" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
--
Thanks,
Gokul Krishna.
--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
---
You received this message because you are subscribed to the Google Groups "QTP
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.