473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Unable to open Excel with macro

I am opening an Excel file on my server, and saving it with some other name and then trying to coping the new excel to my local machine.
If i use a simple Excel(without macro but 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 but on reaching to "oWB = oXL.Workbooks.Open(" it hangs up.


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
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("D:\excelwb\Finance94027_1.xls")

oWB.Close()
oXL = Nothing

Dim OXL2 As New Excel.Application

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

oWBNew.Save()
oWBNew.Close()
OXL2 = Nothing


Catch ex As Exception
Response.Write(ex)
End Try

End Sub
Jan 18 '07 #1
0 1558

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Lize | last post by:
Hi, I'm writing an ASP application to open an excel workbook, then run a macro stored in the excel file, which produces outputs that will be displayed back onto my ASP application. Now the...
3
by: VbUser25 | last post by:
hi.. i have a form i accept some user inputs in the form. there is a link on the form from where i open the excel file in the same browser (not in a new page...simply using a href. i am also...
0
by: Steve Chatham | last post by:
I am stuck on this. It ought to be a simple reason as to why this is problematic, in that it works on smaller groups of data (say under 40 records), but doesn't on larger groups of records (40+)....
1
by: Bon | last post by:
Hello all I create a form with three buttons in MS Access 2000. They are Open Excel Template, Save Draft and Save Final. When I click the Open Excel Template button, the Excel template will be...
0
by: midlothian | last post by:
I have some long Excel routines that I would like to run from my database in a hidden, second instance of the same Access db. The macro I pass to the shell command to open the second instance...
1
by: Patrick Barao | last post by:
I'm trying to have a button open an excel file in an Access database based on the record that the focus is on. Does this require special code or is there a macro that does this? If there is no...
0
by: Nizar000 | last post by:
HI, CAN ANYONE HELP ME TO OPEN A FILE WITH EXCEL MACRO WRITTEN IN VISUAL BASIC, WITHOUT SPECIFING IT'S PATH ? MY TXT FILE IS IN THE SAME PLACE WITH THE EXCEL FILE. THE COMMAND : OPEN...
1
by: deve8ore | last post by:
Hello, I have a fairly simple macro where I can guide the user to the correct directory and file path, however I would like the file with a specific extension (in this example it's an Output file, or...
4
by: mld01s | last post by:
Hi all!! I need help, I have been stuck for a few days on this one. I am trying to open an excel table from a command button in Access. The excel table has an auto_open macro, that is supposed to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.