Re: Compile Error Named Argument Not Found Word 2007

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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@xxxxxxxxxxxxxxxx
To: 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.






.



Relevant Pages

  • Re: VB local drive addressing
    ... Private Property Let NextNumber(myNumber As String) ... The template was stored locally, and the text file is off on an unrestricted (dumping ... opens correctly and the information is duly ... > Private Property Get NextNumber() As String ...
    (microsoft.public.office.developer.vba)
  • RE: Create Word Docs From Excel Cell Data
    ... Dim WordObject As Object 'Word Object ... Dim SigCardPathString As String 'Path & Template ... Anyway the following Excel VBA code opens a word document with a specified ...
    (microsoft.public.excel.programming)
  • Re: Compile Error Named Argument Not Found Word 2007
    ... StevenM/TonyJ/JonathanW ... One creates a new document based on a template, ... Sub NewDoc(pName As String) ... Function Path() As String ...
    (microsoft.public.word.vba.general)
  • Re: Templates
    ... Yes, you're right, which is what I was doing in Notepad. ... I would like the first document to open in its own window as do the ... itself) in either hrizontal direction, that file opens to reveal its content, ... >>the merge feature to place them in the template I created of the HTML code. ...
    (microsoft.public.word.pagelayout)
  • Re: Womble Default Settings?
    ... For example, if I now click the Template button, I would expect ... you can select PAL DVD ... IIRC, when you do the above, you'll get a Command Window which will ... Opens WVW, no other info. ...
    (rec.video.desktop)