Opening a new file from a template
Tom
I've tried what you have suggested, but but still no joy. I have attached
the code if you would be so kind to have a look for me, please bear in mind
it is not finished. I need to resolve this problem before I can move on.
In essence all I am trying to do is email a file based on certain data that
has not been saved and does not need to be kept and then open a new file.
There is probably an easier and better way to do this?
Sub EmailPS27a()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
Application.DefaultFilePath = ThisWorkbook.Path & "\PS27a"
ActiveWorkbook.SaveAs FileName:=ThisWorkbook.Path &
"\PS27aComplete.xls"
With OutMail
.To = "email address"
.CC = ThisWorkbook.Sheets("Template").Range("Q3").Value
.BCC = ""
.Subject = "PS27a Compiled By: National Data Maintenance"
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = ("If you are currently offline this PS27a has been
placed in") _
& vbLf + ("your Outlook outbox and will be sent next time you
logon.") _
& vbLf + ("Or if you are currently online the PS27a has now been
sent.") _
& vbLf + ("") _
& vbLf + ("Do you wish to complete another PS27a in this
session?")
Style = vbYesNo + vbQuestion + vbDefaultButton2
Title = "Another Ps27a?"
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then Workbooks.Add
Template:=ThisWorkbook.Path & "\PS27a(ndm).xlt"
End
MyString = "Yes"
MyString = "No"
'ActiveWorkbook.Close SaveChanges:=False
End Sub
"Tom Ogilvy" wrote in message
...
Workbooks.Add Template:=Thisworkbook.Path & "\PS27a(ndm).xlt"
--
Regards,
Tom Ogilvy
"Mick Southam" wrote in message
...
I don't seem to be able to open a new file from a template, I am using
the
following which will open it as a template, but I need a new file.
Workbooks.Open FileName:=Thisworkbook.Path & "\PS27a(ndm).xlt
Can anyone help please?
--
Kind Regards
Mick
|