473,698 Members | 2,312 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 1575

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

Similar topics

1
6385
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
3706
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
1866
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
3698
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
1455
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
1232
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
14585
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
8668
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
8598
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9152
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6515
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
5857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4612
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
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
3
1995
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.