Re: Compile Error Named Argument Not Found Word 2007
- From: "Tony Jollans" <My forename at my surname dot com>
- Date: Sun, 3 Aug 2008 10:57:18 +0100
Hi Jules,
You need to be a bit more precise with terminology - "opening a new document" is slightly confusing :(
When you open the template, it is not the active document because visible:=false is specified. But, its autoExec macro, if it has one, won't be running anyway.
When you create a new document, it should be the active document - but if it isn't you can always take a reference when creating it by coding:
Set mydoc = documents.add(.....
However, again, its AutoExec macro, if it has one, still won't be running.
--
Enjoy,
Tony
"Jules" <Sam@xxxxxxxxxxxxx> wrote in message news:%234Hu86P9IHA.356@xxxxxxxxxxxxxxxxxxxxxxx
One more question please if I may!
With filename Open if you have Windows in Taskbar (which is to be used) the template on opening a new document and running its autotexec macro is not the activedocument screen - is there any code to force the new document to be the active document screen without too much effort?
"StevenM" <stevencraigmiller(at)comcast(dot)net> wrote in message news:E08EB2A4-EDA9-487E-BA13-46420175FFD2@xxxxxxxxxxxxxxxxTo: Jules,
I've never worked with encrypted documents and/or templates, so I'm not
going to be much help to you on that. But as for:
Set Temp = Documents.Open(Template:=Path & pName, PasswordDocument:="1234",
Visible:=False)
One creates a new document based on a template, but one opens an existing
document (even if that be a template) based on a file name. Thus you need:
FileName:= rather than Template:=
Steven Craig Miller
"Jules" wrote:
I am trying to create NewDoc using encrypted WorkGroupTemplates - below code
works for Word documents not encrypted.
***Code between asterisks courtesy of Greg Maxey
Sub NewDoc(pName As String)
Documents.Add Template:=Path & pName
End Sub
Function Path() As String
Path = Application.Options.DefaultFilePath(wdWorkGroupTemplatesPath)
Path = Path & "\"
End Function
***
I am trying to alter code below - but in line 3 the word "Template" is
highlighted Named Argument Error (Break Mode)
Any suggestions on how to make this work with encrypted (password) files
please? It's way over my skill level without help.
1 Public Sub NewDoc(pName As String) 'Because it says NewDoc is that a
problem?
2 Dim Temp As Document
3 Set Temp = Documents.Open(Template:=Path & pName,
PasswordDocument:="1234", Visible:=False)
Documents.Add Template:=Path & pName
Temp.Close
End Sub
Function Path() As String
Path = Application.Options.DefaultFilePath(wdWorkgroupTemplatesPath)
Path = Path & "\"
End Function
Many thanks.
.
- Follow-Ups:
- References:
- Compile Error Named Argument Not Found Word 2007
- From: Jules
- RE: Compile Error Named Argument Not Found Word 2007
- From: StevenM
- Re: Compile Error Named Argument Not Found Word 2007
- From: Jules
- Compile Error Named Argument Not Found Word 2007
- Prev by Date: Re: Populating Merge Fields programmically
- Next by Date: Re: Compile Error Named Argument Not Found Word 2007
- Previous by thread: Re: Compile Error Named Argument Not Found Word 2007
- Next by thread: Re: Compile Error Named Argument Not Found Word 2007
- Index(es):
Relevant Pages
|