![]() |
Opening a new file from a template
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 |
Opening a new file from a template
Why don't you try changinf the file extation from .xlt
to .xls -----Original 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 . |
Opening a new file from a template
I afraid I've tried that but it still wont work
Thanks and Regards Mick "andres" wrote in message ... Why don't you try changinf the file extation from .xlt to .xls -----Original 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 . |
Opening a new file from a template
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 |
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 |
Opening a new file from a template
I tested the syntax with one of the templates distributed with Excel and the
syntax works fine. Sub OpenWithTemplate() Dim sPath As String sPath = "C:\Program Files\Microsoft Office\Templates\1033\" Workbooks.Add Template:= _ sPath & "Purchase Order.xlt" End Sub I don't know why you are having a problem. That is how it is done. -- Regards, Tom Ogilvy "Mick Southam" wrote in message ... 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 |
All times are GMT +1. The time now is 05:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com