Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Opening Workbook as Read Only and using ".Activate"

I have code that opens the file and activates it:

Workbooks.Open(FileDir & FilesInPath).Activate

But I want to combine this with arguments that will open the file as read
only:

Workbooks.Open(FileDir & FilesInPath).Activate , ReadOnly:=True, _
Password:="Metrics"

This line gives me an error "invalid number of arguments".

Is it possible to open as active as read-only?

Thanks -
--
Regards,
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Opening Workbook as Read Only and using ".Activate"


Set NewBk = Workbooks.Open(FileDir & FilesInPath , ReadOnly:=True, _
Password:="Metrics")

NewBk.Activate



It is not recommended to use SELECT or ACTIVATE method it slows down the
code and switches sheets when it is not necessary. It is better to refer to
the book by its set name

"John Brenner" wrote:

I have code that opens the file and activates it:

Workbooks.Open(FileDir & FilesInPath).Activate

But I want to combine this with arguments that will open the file as read
only:

Workbooks.Open(FileDir & FilesInPath).Activate , ReadOnly:=True, _
Password:="Metrics"

This line gives me an error "invalid number of arguments".

Is it possible to open as active as read-only?

Thanks -
--
Regards,
John

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Opening Workbook as Read Only and using ".Activate"

I'll try that, Joel.

Much obliged.
--
Regards,
John


"Joel" wrote:


Set NewBk = Workbooks.Open(FileDir & FilesInPath , ReadOnly:=True, _
Password:="Metrics")

NewBk.Activate



It is not recommended to use SELECT or ACTIVATE method it slows down the
code and switches sheets when it is not necessary. It is better to refer to
the book by its set name

"John Brenner" wrote:

I have code that opens the file and activates it:

Workbooks.Open(FileDir & FilesInPath).Activate

But I want to combine this with arguments that will open the file as read
only:

Workbooks.Open(FileDir & FilesInPath).Activate , ReadOnly:=True, _
Password:="Metrics"

This line gives me an error "invalid number of arguments".

Is it possible to open as active as read-only?

Thanks -
--
Regards,
John

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
How to Activate "Show all" in a Protected Shared Workbook Anahid Excel Discussion (Misc queries) 1 November 27th 09 01:44 PM
Excel files opening in "read only" Rich D Excel Discussion (Misc queries) 1 March 21st 08 10:46 PM
Activate "current workbook" Darin Kramer Excel Programming 4 September 23rd 05 01:28 PM
Checking before opening "activate:newwindow" to see if already opened sam s via OfficeKB.com Excel Programming 2 September 20th 05 02:37 AM
"Unable to Read File" on workbook containing Pivot Table Michelle Excel Programming 1 June 13th 04 02:18 AM


All times are GMT +1. The time now is 05:34 AM.

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

About Us

"It's about Microsoft Excel"