Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need help unprotecting workbook before importing


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


--
BVHis
------------------------------------------------------------------------
BVHis's Profile: http://www.excelforum.com/member.php...fo&userid=8593
View this thread: http://www.excelforum.com/showthread...hreadid=502238

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Need help unprotecting workbook before importing

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 _
befo=curWkbk.Worksheets(1)

wks.Parent.Close savechanges:=False

End Sub

BVHis wrote:

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

--
BVHis
------------------------------------------------------------------------
BVHis's Profile: http://www.excelforum.com/member.php...fo&userid=8593
View this thread: http://www.excelforum.com/showthread...hreadid=502238


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need help unprotecting workbook before importing


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


--
BVHis
------------------------------------------------------------------------
BVHis's Profile: http://www.excelforum.com/member.php...fo&userid=8593
View this thread: http://www.excelforum.com/showthread...hreadid=502238

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unprotecting Workbook Anto111 Excel Discussion (Misc queries) 1 June 22nd 08 01:37 PM
why do I get a warning when unprotecting a workbook charob Excel Worksheet Functions 1 December 28th 07 02:55 PM
Unprotecting not working in Shared workbook Mark Excel Programming 2 July 19th 05 01:47 PM
Protecting/Unprotecting Workbook Sonny Maou Excel Programming 4 February 18th 04 04:59 PM
unprotecting workbook Jeff Excel Programming 2 December 10th 03 04:11 PM


All times are GMT +1. The time now is 02:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"