473,721 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to open Excel with macro

1 New Member
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.O pen(" it hangs up.


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Try
Dim oXL As New Excel.Applicati on
Dim oWB, oWBNew As Excel.Workbook

oWB = oXL.Workbooks.O pen("\\infpu050 19\KnowledgePla nner\VashiProje cts\CX_ADM\PDLC \Coding\SOURCE\ CVXGENERATEEXCE LFORTRACK\RESOU RCES\Filebag\Fi nance94027.xls" , , , , "Password")

oWB.SaveAs("D:\ excelwb\Finance 94027_1.xls")

oWB.Close()
oXL = Nothing

Dim OXL2 As New Excel.Applicati on

Response.Clear( )
Response.Conten tType = "Applicatio n/vnd.ms-excel"
oWBNew = OXL2.Workbooks. Open("\\infpu05 019\excelwb\Fin ance94027_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 1578

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

Similar topics

1
6386
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 problem I'm having is whenever I try to open a workbook (of any format, i.e. 97/2000, 95, or xp, and of any size, and with or without macros), excel just hangs forever, and if I killed the excel application in task manager, my asp application will...
3
3708
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 accepting input from the user in the excel. now i want to save the data in excel as well as on asp form. i can save directly thru vba code in excel to the db. but suppose the
0
1871
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+). I'm displaying 9 columns in a datagrid, and have a radiobutton at the top of the page that says Web, Excel & Word. Web is selected by default. If you click one of the other two buttons, this code is executed: Private Sub...
1
3700
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 opened. Inside the Excel template, I have assigned a draft watermark to the Print icon. When the Print icon is clicked, the draft watermark and print dialog box is shown. After the user print/edit data in the Excel template, s/he has to click
0
1456
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 contains code to 'Hide' the database (from Dev's site) and also the code which runs the Excel routine. It then quits the database when the code has finished running. Here is my code to open a new instance of my db:
1
1941
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 macro what function do I use to code this? thanks Patrick
0
1233
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 ".\Synthese_Excel.txt" For Input As #5 IS NOT WORKING. THE EXCEL AND THE TXT FILES ARE ALWAYS IN THE SAME DIRECTORY BUT NOT NECESSERY IN A KNOWN DIRECTORY. VERY THANKS IN ADVANCE.
1
2002
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 ".dat") to automatically open, and then save as a text in Notebook. The macro thus far is: ChDir "T:\" Workbooks.Open Filename:=() Pattern = "*.txt*" Where () is a dynamic link that will get the user to the correct folder, and...
4
14587
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 run everytime I open excel. When I navigate to the excel file, and open it, it autoruns the macro with no problems. When I go from Access hit the command, the excel table opens with no problem, but the macro does not auto run on start. Here is...
0
8840
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9064
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.