Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 18th, 2007, 01:52 AM
Registered User
Join Date: Oct 2006
Location: Pune, Maharastra, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unable to open Excel with macro

I want to open an Excel file on server, make some changes to it, save with some other name(on the server itself) and then to open it on my local machine.
If i use a simple Excel(without macro and with password) it works properly but if i use a macro and make the excel password protected then it does not allow me to open it.

It does not give any exception.
The code gets hang at "oXL.Workbooks.Open"

 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim oXL As New Excel.Application
            Dim oWB, oWBNew As Excel.Workbook

            oWB = oXL.Workbooks.Open("\\infpu05019\KnowledgePlanner\ VashiProjects\CX_ADM\PDLC\Coding\SOURCE\CVXGENERAT EEXCELFORTRACK\RESOURCES\Filebag\Finance94027.xls" , , , , "Password")

            oWB.SaveAs("\\infpu05019\excelwb\Finance94027_1.xl s")

            oXL = Nothing

            Dim OXL2 As New Excel.Application

            Response.ContentType = "Application/vnd.ms-excel"
            oWBNew = OXL2.Workbooks.Open("\\infpu05019\excelwb\Finance9 4027_1.xls", , , , "Password")

            OXL2 = Nothing

        Catch ex As Exception
        End Try

    End Sub

sourav gupta

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to open excel file thru vb.net sreeramulu Javascript 5 December 6th, 2013 04:19 AM
Unable to create Macro valdetero Excel VBA 0 July 26th, 2007 02:58 PM
Unable to save Excel with macro on server guptasourav Classic ASP Basics 0 January 17th, 2007 05:21 AM
Could not open macro storage tigerkit Beginning VB 6 7 September 20th, 2006 02:56 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.