Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Open Password Protected Excel Workbook In Visual Basic


Hello,My VB 6.0 application read and writes data from and to a MS Excel workbook,using the Microsoft.Jet.OLEDB.4.0 provider.Now I want to protect the Excel workbook with a password, but I figured outthat it is not possible to open the workbook for data access with ADO(http://support.microsoft.com/?KBID=211378).Is there another way to use a password protected Excel workbook in myapplication?Regards,Geert-Pieter




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Open Password Protected Excel Workbook
I'm currently using GetObject to access an existing workbook from a VB app. I modify and save the workbook without the user ever seeing it. I need to password protect the workbook, but can't figure out how to access it once it's protected. I do not want the user prompted for a password. Any help will be appreciated.

Open An Excel Workbook From Visual Basic
Hi all,

How can I open an excel workbook from visual basic 6.0?

Regards,
Anirban

Visual Basic To Make A Pdf File Password Protected
I want an idea , which could help me to make a pdf file password protected using visual basic coding

How To Connect Password Protected Asscess Database In Visual Basic Project
hi,
i locked my access database with password.
when i tried to connect the database from visual basic adodc control
it is displaying error...
how to connect it...?
regards,
madhu

Open Password Protected Excel In VB EXE
Hi
i am new to VB and banging my head for long for this problem

We have an EXE that process Excel Files( first convert data in XML and then enter data into database)

Now sometime Excel files which users upload are "password protected" and becuase of those file , Exe go into Hung state

I have an option to stop the Exe( without stop, file can't be removed) , remove the corrupt file and start again , but i don't have priviledge to do so

I have found one solution, the following code :

On Error GoTo ErrOpenFile

'We will not provide with a valid password
'Error number will be 1004

Workbooks.Open FileName:="c: emp emp.xls", Password:=""

ExitHere:
Exit Sub

ErrOpenFile:
If Err.Number = 1004 Then
'Either inform member or comment the below to do nothing and
'proceed to next file
MsgBox "Password Protected."

'Proceed with next file
Resume Next
End If

but this works for first time only ,when it process Bad File --> right file

but if suppose i have , Bad File --> right file --> Bad File2 , then on processing file 2 it start giving this error :

Run-time error 1004
The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization.

I really don't know what to do ??

Please help , thanks in advance !!

Open Password Protected Excel Sheet In VB
Can anyone help please, I've written a small program to open a directory on my pc and produce a list of Excel files, I can then pick a file to open, what I need is a way of putting in the password automatically if it's protected, I need this for VB not VBA

Open Password Protected Excel File
Hi,
I have passowrd protected a file using File->Save As->name Options passowrd. Now I need to import data from excel to Access and I dont want to prompt user for password. I tried to use Activeworkbook.unprotect but it doesnt work. How can open a password protected file.

-Leena

Open Password Protected Excel File
I would like to write code that will open an MS Excel file through code. The address will be hard coded into the program. I know to use Shell(), but the excel file is password protected and I would like to send the password to the file via code so the user doesn't have to enter it. Can it be sent via a command line switch? If so, what is the switch and syntax? If not, is there another way (aside from SendKeys())?
I know what you are thinking "why have a password in the first place if you don't want the user to use it?". Well, that's a valid question, but the answer is a long story that I'd rather not get into.
Any help is greatly appreciated.

Thanks,

Fastest Way To Open Password Protected Excel File...?
Hi... all...

Any one know the fastest way to open password protected excel file...?

except this :

VB Code:
Excel.Workbooks.Open "e:N.xls", , , , zPass


I'm trying to recover the password of one important file.. and i'm using brute force....
If i use the above command then it takes half second to open every time..

Knowing If A Excel File Is Password Protected Before Open
Hello,

it is possible to know if an Excel file is password protected before open it?.

Best Regards

How To Open Password Protected Excel File To Extract Data?
Hey everyone,
I'm relatively new to VB and after being stuck for a while, I decided to ak the experts . I am writing a program which reads in information from an excel workbook. I need to password protect the excel workbook (which I have done) so that when this program is distributed noone can open the excel file except through my program(unless they have the password). Furthermore, I need to implement some sort of test into my code so that my program can tell if the excel file it is accessing is password protected, and determine if the password matches the one hard coded in my software. AKA, if the program tries to open an excel file that someone made with the same name as the original, but the new one IS NOT password protected, then the program will not open the file and will fail to load the program. As I said, my knowledge of VB is still rather inadequate but I'm trying. If it helps, I'm running vb 6.0. I pasted a chunk of my code below that opens the excel workbook when it is not password protected. Thanks in advance everyone.

Set wbModelInfoLookup = appExcel.Workbooks.Open(MN_Info_Lookup)


MN-Info_Lookup is just a global variable that represent the workbook being opened. wbModelInfoLookup is a locally declared object

Information Out Of A Closed, Password Protected Workbook
Dear Friends,

I was wondering if someone knows how you can get information out of a closed, password protected workbook without opening it.....

I've already know how to open a pasword protected workbook via code.. but sindds there are over 300 workbooks I realy would like to keep them closed

I 've also know how i can get information out of closed workbooks.

The combination however.... thats a question for me :S


thanks for your time

Converting Excel Workbook Into Visual Basic Program
Currently, I have a very large Excel workbook that functions as a fiscal analysis tool. It is 12 worksheets w/ around 500 lines on each sheet. There are numerous data inputs and numerous outputs and results screens and tables. My 'master plan' is to convert all of this into a visual basic program with windows, etc..so that it looks sleek and easy to use.

1st--is this possible? Can you take an excel model and turn it into something windows like? I want a program that is run from this spreadsheet, but has a very nice user interface; hence where I believe visual basic may be helpful. (or perhaps some other program?)

2nd--any many hours would it take to make this happen, if it can occur? would this be something that I could take upon myself after learning visual basic or would this be something, due to the large excel file involved, that would need to be done by an outside computer consultant?

I appreciate any help or suggestions. I feel like this model that i currently have in excel would be much more marketable as a more user friendly program.

Thanks,

Brian Martin

Opening And Saving An Excel Workbook In Another Format From A Visual Basic Executable
I would like to Open an Excel Workbook with the .xls extension and save that same Workbook as a xlCSV (.csv) type document.

Using an Excel Macro works

ActiveWorkbook.SaveAs "book1" , xlCSV

but when I attempt to use the SaveAs method from outside Excel I get the following error

run-time error 1004
SaveAs method of Workbook class failed

This is the code that I compiled and ran

Private Sub
     Dim Excel As Object
     Dim Workbook As Object
     Set Excel = CreateObject("Excel.Application","")
     Excel.Visible = False
     Set Workbook = Excel.Workbooks.Open("book1.xls")
     Workbook.SaveAs "book1" , xlCSV
End Sub

I have written a C++ program that processes a .csv document format, and I would like to convert .xls documents to .csv with this function for my C++ program.

Is there something wrong with my vb code, or is there something wrong with the SaveAs method?

Thanks,
userName

Open Password Protected MDB's
How do I open password protected MDB's. Even when I try to build a connection string through ADODC it asks me for a work group file

Open Password Protected Folder
Infile = App.Path & "SAP.dat"
If Dir(Infile) = "" Then 'Checking SAP.dat exists or not
Msg = Infile & " does not exist."
Else
Mydate = Format(Date, "YYMMDD")
Mytime = Format(Time, "HHMMSS")
NewName = "\sapt01KPIINTERFACEpblin" & PlantName & strPreFix & Mydate & Mytime & ".txt"
Name Infile As NewName 'Cut n paste
'FileCopy Infile, NewName 'copy n paste
Msg = Infile & " has changed name to " & PlantName & strPreFix & Mydate & Mytime & ".txt"
End If
MsgBox Msg

i used this methos to open a folder to save a file..but now the problem is the folder is password protected..i know the username and password but i want my program did login backgroundly..how can i modified the code to open and save a file there.

Open A Password Protected Database
Can anyone show me how I can open a passoword protected Access 2000 database.

At the moment I am opening the database as below but I would like to password protect it. I have tryied MSDN but I can get it to work.

Dim dbMyDB As Database
Dim rsMyRS As Recordset

Private Sub Command1_Click()
Set dbMyDB = OpenDatabase("D:VB CodeDatabaseHardware maintenance.mdb")
Set rsMyRS = dbMyDB.OpenRecordset("Hardware", dbOpenDynaset)

Open Password Protected Folder
hi there..

i have a database(acnielsen.mdb) in a password protected folder(acnielsen). this folder resides in a pc running windows 95. the name of the pc cts_testing. the database it self is not password protected...

i am using data access objects 3.5

this is my code...

Set dbs = Workspaces(0).OpenDatabase("\Cts_testingacnielsenacnielsen.mdb", False, False)

the last parameter for the opendatabase function is where i set the password..how do i set the password required to open the folder...

if you are not sure how , can please suggest me another way..

Open A Password Protected Access Db
Can i open a access Database with a password

as the following way or any other way?

____WordPath = "C:Program FilesMicrosoft OfficeOFFICE11WINWORD.exe"
____Shell WordPath & " """ & ToOpen & """", vbNormalFocus

How To Open A Password-protected Table?
hi, I want to create ADO recordset of a Paradox file, but then the file is password-protected. how can I modify the code so that can open? (the codes work fine with non-password-protected paradox file).Thanks...

    Dim dbConn, rsConn, strSQL

    Set dbConn = CreateObject("ADODB.connection")
    dbConn.Open ("dsn=testing")
    strSQL = "select * from Test1"
    Set rsConn = dbConn.Execute(strSQL)
    

Open Password Protected Database
Hello,

I have a VB6 SP5 application which has a bound data control field. I want to pasword protect an Access 2000 database. I would like to use the connect property to supply a password. My connect property field looks like:

          Access 2000;pwd=<password>;

When I run the application I get "Could not find installable ISAM."

Thanks for your help!!!


How To Open A Password Protected MDB File
Hi guys

I found this code on the net

Code:
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=c:somepathmydb.mdb;" & _
           "Jet OLEDBatabase Password=MyDbPassword", _
           "myUsername", "myPassword"
 



But, my MDB is only using database passoword.
so, i tried

Code:
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
           "Data Source=c:somepathmydb.mdb;" & _
           "Jet OLEDBatabase Password=" & "MyDbPassword"
 

and it doesnt seems to work.
can anyone provide me with a working connection string?
thanks a million

How To Open A Password Protected MS Access DB
Hi,

I have a VB6 app that opens up a MS Access 97 database. My vb app runs a function located in access. I got it to work fine. The problem I have now is that the access db is now password protected, and I can't seem to know how exactly to pass the password. Below is a sample of my code.


Code:

Set accApp = New Access.Application

With accApp
lngAccHandle = .hWndAccessApp
.OpenCurrentDatabase strDB_PathName, True ' opened exclusively
.Visible = False
.DoCmd.SetWarnings False
ShowWindow lngAccHandle, SW_HIDE ' hide access window , else shows in taskbar
.Run "RunJob", strOutput_PathName, strBkUp_PathName, strLogFile_PathName
.DoCmd.SetWarnings True
.Quit acQuitSaveAll
End With

Set accApp = Nothing


As you can see, I am using the OpenCurrentDatabase() method but it does not take User or Password as a paramater.

How else can you run a function on a password protected access database?

Any help much appreciated...

How To Open Password Protected Access DB
Hi,

How to open a password protected MS Access database.

Thanks.
Shoby

Open A Password Protected Word Documnet Using Vb
hi everybody
i want to know whether it is possible to open a password protected word document from a vb program
i want to know how the password can be passed to word from vb
thanks in advance

Open Password Protected Ms Ccess Database
how to open password protected ms access database through adodc data control or through data control in vb6 ?

How To Open A Password Protected MDB Using DAO Datacontrol(DATA1)? (HELP PLEASE)
Hi,

How can we open a password protected MDB using DAO datacontrol(DATA1)?. please give code. Because I used too may DATA control in my project.

cheers,
senthil

Open Password Protected Database With Shell
Hello, all,

Wondering if someone can help me with this. I am trying to open a database using the shell command. This works good. I would like to be able to do the same thing on the database if it is password protected. I am not using any workgroups or anything, just a regular old database password. I want to actualy open the database, not connect to it which I know I can do via DAO/ADO.

Thanks in advance,

Strick

Open Password-protected Access File ?
hi

i have an access db file with a pass. and i want to
open it through VB and i want to include the pass.
through coding as in:

set db=opendatabase ("c:ggg.mdb",[shall i include the pass.
in here ])


any help


thanx in advance

How To Open MSAccess Data With Password Protected
Hi there!

Need help on VB5. I tried number of times to Open MSAccess data(I protect with a password on it), when I run my program in VB5 & it prompt me "Run-time error 3031, Not a valid password, therefore I can't open it. Anyone can help me, how to decode MSAccess password in VB5 statement. Thanks

Rgds,
Sam

How To Open MSAccess Data With Password Protected
Hi there!

Need help on VB5. I tried number of times to Open MSAccess data(I protect with a password on it), when I run my program in VB5 & it prompt me "Run-time error 3031, Not a valid password, therefore I can't open it. Anyone can help me, how to decode MSAccess password in VB5 statement. Thanks

Rgds,
Sam

How Do I Open Access File With Password Protected
Hello to all,

I want to open an MS access file with password protected.
Anybody know this please help..



Thanks
Joseph

How To Open Access File With Password Protected In DAO.
hello group,

how open access file with password protected in DAO?

thanks / altaf

How To Open A Password Protected Access Database In Vb?
Please help me! I am trying to open a password protected database using vb.I appreciate if someone can provide me with the codes. I put a password in the Database so that people can't edit from it,but now my problem is how can i access the record using vb.

Here is my codes:

Private Sub Form_Load()
    Dim reply, prompt
    Set dbTimeRecorder = OpenDatabase("C:ClockTimeRecorder.mdb", False, False)
    Set rsEmployee = dbTimeRecorder.OpenRecordset("Employee", dbOpenTable)
    Set rsRecords = dbTimeRecorder.OpenRecordset("Records", dbOpenTable)
    Me.Show
    prompt = "YOUR CURRENT SYSTEM DATE IS " & UCase(Format(Date, "MMM.DD, YYYY")) & " IS THIS CORRECT?"
    reply = MsgBox(prompt, vbYesNo, "SYSTEM DATE CHECK")
    If reply = vbYes Then
        frmSplash.Show 1
    Else
        Calendar.Show 1
    End If
    With rsEmployee
    While Not .EOF
    '.MoveFirst
    If !In = "YES" And !Indate = Date Then
    lstPresent.AddItem !Firstname & " " & !LastName
    .MoveNext
    Else
    .Edit
    !In = "NO"
    .Update
    .MoveNext
    End If
    Wend
    End With
    
    
End Sub




Edited by - labmher on 2/25/2003 8:07:18 PM

Open Report In Password-protected Database / ADO
Hi there,

using VB 6.0 ADO and MS-Access2000-Runtime, I try to run a report, which is stored in the database. The database is secured by a general password.
Accessing data in the database is no problem,
but what would be the syntax to open a report?

I have not found a suitable solution to this point of time.

Any hint is appreciated and welcome...

Best Regards.

How To Open Password Protected ACCESS Database
Hi...
I have given a password in access. Now I want to use database in VB through DAO. How do i do this?
Kindly help. Urgent!!!

Thanks in advance

Santulan

How To Open A Password Protected MDB Thru Data Control
Hi
I've set a paasword for a MDB (MS Access created Database), but I don't know how to set the password as well for the Data Control bound to the Database, in DESIGN TIME. Which property of Data Control is actually used to set the password (During Design-Time) in order to gain access to a password-protected MDB during run-time ? I don't want to use DAO to open the database and then assign it to the data control, coz it's quite troublesome and tedious to do so. Thanks in advance, sincerely

How To Open Excel Spreadsheet In Visual Basic
I want to use Excel Spreadsheet as a datafile and read the data in Visual Basic. How do I do that? In other words, I want to read a Excel file in Visual Basic and retrieve the data from the file. Should I use the Excel control? Thanks in advance

How Do I Open A Password Protected MS Access 2000 File From VB?
How do I open a password protected MS Access 2000 file from VB?

I have a control button to open Access file

Code without password:

ShellExecute hwnd, "Open", App.Path & "Database.mdb", "", "C:", 3

Open Access Password Protected Database Issues.
Hi, I am having trouble in perhaps both creating and opening an access password protected database. I opened the database for exclusive user only and created a password for the database. On trying to acces it via an ADODC control, I get an error stating workgroup absent or opened exclusively by user.
How can I avoid this by connection via ADODC control page property and via connection string thanks.

How To Open A Password Protected Webpage With Webbrowser Control?
I need to open password protected pages using webbroser control, I had been looking for a solution but I can't found a method to do it.

I will appreciate your help

Open Shared Password Protected Files And Folders
First off, I'd like to congratulate all of the responders on the forum. You have made this site an invaluable tool for finding answers to questions. On behalf of myself and everyone else, THANKS!

Now for my hopefully simple question. Can someone give me an example of opening a password protected file and/or folder on a network computer using Visual Basic? I can see no way to pass a known password to a DirList or FilList, nor any commands to pass the password to the requesting system. How is this done? Any help would be appreciated. Thanks.

Visual Basic Excel -&gt; Open Drive And List Box
i'm using Excel Visual Basic(MaCRO) to open up the data file and chart on its own.

But due to the souce code i hav create, i can only view the folder name that i have display.

Public Function fishing() As String
Dim File2 As String
Dim q, y, Combobox1_Count As Integer

'Remove any item from combobox2
While Sheet1.Combobox2.ListCount > 0
Sheet1.Combobox2.RemoveItem 0
Wend

'Extract FileName from text file
Set fs = Application.FileSearch
With fs
.LookIn = "C:"
.Filename = "*.*"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
'MsgBox "There were " & .FoundFiles.Count & _
' " file(s) found."

For i = 1 To .FoundFiles.Count
Sheet1.Combobox2.AddItem .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With

End Function

I will need to change the souce code every time if i hav display in different folder.

I found out that i need to use the dirlistbox and Drivelistbox but this two buttons is not in the excel.

so can anyone tell me what kind of control or souce code i can use without use this two control button?

Open File Dialog In Excel Through Visual Basic
Hello... I'm trying to find the code to do the following.

public sub
Dim strMyFile as String
strMyFile = (file opener dialog)
(rest of code)
end sub

But I'm having trouble finding the appropriate dialog menu command... can you point me in the right direction?

Open A Password-protected Database Through Automation In Access 2000
Hello All,

I'm using the above with some difficulties, the
only problem that I have left with is the Access prompt message.

When opening the DB to copy from, Access prompt
a question window (attached image...), how can I go with
the process without this Access msgbox?

currently using:

Code:
Dim tmpDB As DAO.Database
Dim objApp As Object
Dim Source As String, Destination As String
Source = App.Path & "file.mdb"
Destination = App.Path & "new_file.mdb"
Set objApp = CreateObject("Access.Application")
objApp.Visible = False
Set tmpDB = objApp.DBEngine.OpenDatabase(Source, False, False, ";PWD=mypass")
objApp.OpenCurrentDatabase Source
tmpDB.Close
Set tmpDB = Nothing
objApp.DoCmd.TransferDatabase acExport, "Microsoft Access", Destination, acTable, "Table_1", "Table_1"
objApp.CloseCurrentDatabase
objApp.Quit
Set objApp = Nothing

How To Open A Password Protected Access2000 Database And Rename A Table
Hi,

1. How to open a password protected MS-Access 2000 databse in vb?

2. How to rename a table after creating it in vb6.0?

Thanx in advance....

Design And Open Reports That Connects To Password Protected Database
Hi,
I need some urgent help. I have created a database application in VB that opens a password protected access
database. I have manage to code the password for the DAO to open it. But I am having major league problems with the connection
for the designer for the reports. Each time I want to connect to the connections in design mode, I get prompted for a password.
When I try to supply the password, it says that the workgroup file is missing and reports that the connection failed.
Why does it keep prompting for passwords at run time and design time when I try to access reports.

Help! I have fallen and I can't get up!

Mirak

How To Open MS Access Database Which Are Password Protected Using MS ADODC Control
Hello to all of u once again...

Now i am in BIG trouble... i hav one more week to complete this project and i cant find a method to connect MS Access Database(a password protected database) to MS ADODC Control.

I hav the codes to conncect Password Protected database with DAO 3.6, but not with ADODC Control.

So can anyone of u help me by givin the steps for how to solve my problem. It wud do a great help for me.

Thanking you in advance...

Adhu

Open Crystal Report That Conect To Password Protected Database
Hello everybody:

I'm using VB6 to show the reports. I already add a form with Crystal Report Viewer, but the problem is when I tryed to open the report. It shows me a message that the user account is not valid.
The crystal report already exists and it conects to a password protected database (Access), this database also has user accounts.
If i open the report on crystal report it ask me for user, password, Jet database password and Jet system database.
I want to know if the code i'm using is the correct for this.

My code is:

Dim CrxApp As New CRAXDRT.Application
Dim oReport As CRAXDRT.Report

Set CrxApp = New CRAXDRT.Application


Set oReport = CrxApp.OpenReport(DBPath & "Ced.rpt", 1)
oReport.ParameterFields.GetItemByName("muni").AddCurrentValue id_muni
oReport.ParameterFields.GetItemByName("dpto").AddCurrentValue id_dpto

For i = 1 To oReport.Database.Tables.Count
 oReport.Database.Tables(i).SetLogOnInfo "LocaLPC", "Ced.mdb", "User", "passwor"
Next

CRViewer91.ReportSource = oReport
CRViewer91.DisplayGroupTree = False
CRViewer91.EnableGroupTree = False
CRViewer91.EnableAnimationCtrl = False
CRViewer91.ViewReport

Please help me!!


Claudia

Copyright 2005-08 www.BigResource.com, All rights reserved