Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default savecopyas read only

Hi - xl 03, rdb 6 (modified to save entire workbook)

I use the code below to save the entire workbook modified from rdb 6 copy
code. I've inserted the following savecopyas to accopmlish, but would like
it to be read only and can't figure out throug the help to do this.

TIA,
Anders

Sourcewb.SaveCopyAs (FolderName _
& "\" & "Archived Copy" & " " & "as of" & " " &
DateString & ".xls")

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default savecopyas read only

strFile = "Archived Copy" & " " & "as of" & " " & _
DateString & ".xls"

Sourcewb.SaveAs Filename:=FolderName & "\" & strFile, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=True

'Set password if you need.

If this post helps click Yes
---------------
Jacob Skaria


"Anders" wrote:

Hi - xl 03, rdb 6 (modified to save entire workbook)

I use the code below to save the entire workbook modified from rdb 6 copy
code. I've inserted the following savecopyas to accopmlish, but would like
it to be read only and can't figure out throug the help to do this.

TIA,
Anders

Sourcewb.SaveCopyAs (FolderName _
& "\" & "Archived Copy" & " " & "as of" & " " &
DateString & ".xls")

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default savecopyas read only

Do your .SaveCopyAs, then open that workbook and save it the way you want, then
close that workbook.

Dim myName as string
dim TempWkbk as workbook

myname = FolderName & "\" & "Archived Copy" & " " & "as of" _
& " " & DateString & ".xls")

sourcewb.savecopyas filename:=myName

set tempwkbk = workbooks.open(filename:=myname)
with tempwkbk
application.displayalerts = false 'hide that "overwrite prompt"
.saveas filename:=myname, WriteResPassword:="yourpassword"
application.displayalerts = true
.close savechanges:=false
end with

(Untested, uncompiled. Watch for typos.)

====
With Screenupdating set to false, you won't know that it was opened, saved, and
closed.

Anders wrote:

Hi - xl 03, rdb 6 (modified to save entire workbook)

I use the code below to save the entire workbook modified from rdb 6 copy
code. I've inserted the following savecopyas to accopmlish, but would like
it to be read only and can't figure out throug the help to do this.

TIA,
Anders

Sourcewb.SaveCopyAs (FolderName _
& "\" & "Archived Copy" & " " & "as of" & " " &
DateString & ".xls")


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default savecopyas read only

Jacob - works great thanks!

Dave - Same! The only typo is the ( is missing in = FolderName

Really -- thank you both for the quick responses!

Best,
Anders

"Dave Peterson" wrote:

Do your .SaveCopyAs, then open that workbook and save it the way you want, then
close that workbook.

Dim myName as string
dim TempWkbk as workbook

myname = FolderName & "\" & "Archived Copy" & " " & "as of" _
& " " & DateString & ".xls")

sourcewb.savecopyas filename:=myName

set tempwkbk = workbooks.open(filename:=myname)
with tempwkbk
application.displayalerts = false 'hide that "overwrite prompt"
.saveas filename:=myname, WriteResPassword:="yourpassword"
application.displayalerts = true
.close savechanges:=false
end with

(Untested, uncompiled. Watch for typos.)

====
With Screenupdating set to false, you won't know that it was opened, saved, and
closed.

Anders wrote:

Hi - xl 03, rdb 6 (modified to save entire workbook)

I use the code below to save the entire workbook modified from rdb 6 copy
code. I've inserted the following savecopyas to accopmlish, but would like
it to be read only and can't figure out throug the help to do this.

TIA,
Anders

Sourcewb.SaveCopyAs (FolderName _
& "\" & "Archived Copy" & " " & "as of" & " " &
DateString & ".xls")


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default savecopyas read only

Actually, the
myname = foldername & ... & ".xls")
had an EXTRA ) at the end. It isn't necessary.

And be aware that there is a difference in Jacob's suggestion and mine.

Jacob's code will have the new file (.saveas) as the activeworkbook.

My code won't touch the current workbook (since it uses .savecopyas).

Anders wrote:

Jacob - works great thanks!

Dave - Same! The only typo is the ( is missing in = FolderName

Really -- thank you both for the quick responses!

Best,
Anders

"Dave Peterson" wrote:

Do your .SaveCopyAs, then open that workbook and save it the way you want, then
close that workbook.

Dim myName as string
dim TempWkbk as workbook

myname = FolderName & "\" & "Archived Copy" & " " & "as of" _
& " " & DateString & ".xls")

sourcewb.savecopyas filename:=myName

set tempwkbk = workbooks.open(filename:=myname)
with tempwkbk
application.displayalerts = false 'hide that "overwrite prompt"
.saveas filename:=myname, WriteResPassword:="yourpassword"
application.displayalerts = true
.close savechanges:=false
end with

(Untested, uncompiled. Watch for typos.)

====
With Screenupdating set to false, you won't know that it was opened, saved, and
closed.

Anders wrote:

Hi - xl 03, rdb 6 (modified to save entire workbook)

I use the code below to save the entire workbook modified from rdb 6 copy
code. I've inserted the following savecopyas to accopmlish, but would like
it to be read only and can't figure out throug the help to do this.

TIA,
Anders

Sourcewb.SaveCopyAs (FolderName _
& "\" & "Archived Copy" & " " & "as of" & " " &
DateString & ".xls")


--

Dave Peterson


--

Dave Peterson
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
wb.savecopyas results in read only copy mikeolson Excel Programming 2 March 2nd 07 10:45 PM
SaveCopyAs Mark Excel Programming 2 July 17th 06 05:24 PM
saveCopyAs judith Excel Programming 1 September 29th 04 11:21 AM
SaveCopyAs Greg Hadrych Excel Programming 4 July 28th 04 07:49 PM
SaveCopyAs Mark Worthington Excel Programming 4 February 8th 04 06:00 AM


All times are GMT +1. The time now is 09:57 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"