Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Need help unprotecting workbook before importing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BVHis - 17 Jan 2006 21:41 GMT
I'm trying to import a workbook into an open workbook using the code
below, however, the workbook I'm trying to import has a password.  The
password is blank (essentially no password).

Sheets.Add Type:= "E:\mattw\My Documents\My Timesheets - 2006.xls"

So.... since it's "password protected" with a null password, how can I
unprotect the workbook BEFORE importing it??  Do I have to open it,
then remove the protection, or can I remove the protection while I'm
inserting it?

Thanks in advance!

Matt W

Signature

BVHis

Dave Peterson - 17 Jan 2006 23:05 GMT
Maybe you could just open the workbook, steal a copy of the worksheet and close
that workbook:

Option Explicit
Sub testme()

   Dim wks As Worksheet
   Dim curWkbk As Workbook
   
   Set curWkbk = ActiveWorkbook
   
   Set wks = Workbooks.Open _
              (Filename:="c:\my documents\excel\book3.xls").Worksheets(1)
   
   wks.Copy _
       before:=curWkbk.Worksheets(1)
   
   wks.Parent.Close savechanges:=False
   
End Sub

> I'm trying to import a workbook into an open workbook using the code
> below, however, the workbook I'm trying to import has a password.  The
[quoted text clipped - 16 lines]
> BVHis's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=8593
> View this thread: http://www.excelforum.com/showthread.php?threadid=502238

Signature

Dave Peterson

BVHis - 20 Jan 2006 20:32 GMT
Can I copy multiple worksheets in one shot doing it that way, or would I
have to copy 1 worksheet at a time??

Matt W

Signature

BVHis

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.