Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following is one we have used for a while, but the names have been
changed to protect the innocent. Darrell Sub Send_Msg() Dim objOL As New Outlook.Application Dim objMail As MailItem Set objOL = New Outlook.Application Set objMail = objOL.CreateItem(olMailItem) j = Range("From").Text 'save form as ffff.xls Sheets("form").Copy ActiveWorkbook.SaveAs FileName:="\\test-fs\File Share\bids\ffff.xls", FileFormat:=xlNormal, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False 'convert to values Cells.Select Selection.Copy Selection.PasteSpecial Paste:=xlValues 'delete objects ActiveSheet.DrawingObjects.Select Selection.Delete Application.DisplayAlerts = False 'delete range names For Each r In Names r.Delete Next r Application.DisplayAlerts = False ActiveWorkbook.Save ActiveWorkbook.Close msg = "Mary," & Chr(13) & Chr(13) msg = msg & "The attached excel file shows a new job that needs to be setup." & Chr(13) msg = msg & "Please inform Fred of the Job number." & Chr(13) & Chr(13) msg = msg & " Thanks," & Chr(11) msg = msg & " " & j addee = " CC = " With objMail .To = addee .CC = CC .Subject = "New job" .Attachments.Add "\\test-fs \File Share\bids\ffff.xls" .Body = msg .Display '.Send End With Set objMail = Nothing Set objOL = Nothing Kill "\\test-fs \File Share\bids\ffff.xls" 'MsgBox "File has been e-mailed to " & addee (Removed because of Security option in Outlook) End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
After further investigation, I have found that the problem exists when
we open the file using a shortcut, icon, or xla shortcut. When I open the file by opening excel first and then open the file by using the path file/open etc., the code works fine. It seems for some reason that it can't figure out what the correct path is without opening excel that way first. The 2 guys with the problem can open the file that way, but I would still like for them to use their shortcut or xla shortcut. Any ideas? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Problem solved.
I went to Tools, Options, General and changed the Default file location to match the network drive location and that fixed the problem. The default file location originally was set to C:\. I wouldn't have thought something as simple as that would have fixed the problem, but it seems to have worked. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro to copy value from 2nd file, if a word found in a correspondingrow of both files | Excel Discussion (Misc queries) | |||
FOUND LOST FILE BUT COPY IS MISSING | Excel Worksheet Functions | |||
If not found get a message | Excel Programming | |||
Copy and Paste from Excel into Outlook Email message | Excel Programming | |||
"file not found" error message when launching source file | Excel Programming |