Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Excel 2000 vs 2003 programming problem?

Hello,

I have been using the macro below (originally seen in Ron DeBruin's website)
to send a file by email using Excel 2000, and all is OK.

I have sent this file to a work colleague who has Excel 2003, and a problem
comes up when he runs the macro, but I don't know why it doesn't work.

The error states that Excel 2003 "cannot access the Read only file". When I
click on "debug", the VBA Editor highlights this line of code in yellow:


"wb1.SaveCopyAs wbname"


Can anyone advise me if this an Excel problem, or can it be from Outlook
2003?
Any help will be greatly appreciated.

Also is there a way to include program code so that Excel does NOT ask to
confirm before sending an email. I realise this protection is to avoid the
distribution of malicious code but what if I am a trusted source??

Thank you in advance

rgds

André


Original code:

Sub Mail_Workbook()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim wbname As String
Dim emplname As String

emplname = Worksheets("BTA").Cells(2, 4).Value

Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
wbname = "C:\" & emplname & ".xls"
wb1.SaveCopyAs wbname
chDir "c:\"
Set wb2 = Workbooks.Open(wbname)
With wb2
.SendMail ", _
"Travel Request for Approval - " & emplname
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
End With
Application.ScreenUpdating = True
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Excel 2000 vs 2003 programming problem?

wb1.SaveCopyAs wbname

It would seem that a file with the target name already exists an it is
read-only. At least when I set that up I get the same error message.

--
Jim
"Andre Croteau" wrote in message
...
| Hello,
|
| I have been using the macro below (originally seen in Ron DeBruin's
website)
| to send a file by email using Excel 2000, and all is OK.
|
| I have sent this file to a work colleague who has Excel 2003, and a
problem
| comes up when he runs the macro, but I don't know why it doesn't work.
|
| The error states that Excel 2003 "cannot access the Read only file". When
I
| click on "debug", the VBA Editor highlights this line of code in yellow:
|
|
| "wb1.SaveCopyAs wbname"
|
|
| Can anyone advise me if this an Excel problem, or can it be from Outlook
| 2003?
| Any help will be greatly appreciated.
|
| Also is there a way to include program code so that Excel does NOT ask to
| confirm before sending an email. I realise this protection is to avoid
the
| distribution of malicious code but what if I am a trusted source??
|
| Thank you in advance
|
| rgds
|
| André
|
|
| Original code:
|
| Sub Mail_Workbook()
| Dim wb1 As Workbook
| Dim wb2 As Workbook
| Dim wbname As String
| Dim emplname As String
|
| emplname = Worksheets("BTA").Cells(2, 4).Value
|
| Application.ScreenUpdating = False
| Set wb1 = ActiveWorkbook
| wbname = "C:\" & emplname & ".xls"
| wb1.SaveCopyAs wbname
| chDir "c:\"
| Set wb2 = Workbooks.Open(wbname)
| With wb2
| .SendMail ", _
| "Travel Request for Approval - " & emplname
| .ChangeFileAccess xlReadOnly
| Kill .FullName
| .Close False
| End With
| Application.ScreenUpdating = True
| End Sub
|
|


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
Problem sorting in Excel 2000 vs. 2003 David P. Excel Discussion (Misc queries) 3 April 26th 07 03:56 AM
Problem with Excel 2000 / 2003 TonTon165 Excel Discussion (Misc queries) 0 July 17th 06 08:14 PM
Excel 2000 - 2003 Compatability problem with pivottables [email protected] Excel Programming 0 May 24th 06 07:54 PM
Calender Object problem in Excel 2000 and 2003 Suketu Excel Discussion (Misc queries) 0 April 20th 06 08:29 PM
Problem with opening an Excel 2000 workbook in Excel 2003 Frank Krogh[_2_] Excel Programming 0 June 3rd 04 11:31 AM


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