From: Mo on
Hi,
When creating a new Word document from a library in Sharepoint and then
saving it from Word, it suggests to save it in that same library I created
the document from. I would like to know how Word "knows" which library to
suggest? Can I find that information programatically?

What I want to achieve is that the created document programatically creates
another new document and saves it to the same library as the original
document was created from. And I don't intend to save the first created
document. I know how to do this except to find the path to the library.

Any help is highly appreciated,

Peeter
From: Doug Robbins - Word MVP on
How is the document actually being created? From a template or by opening a
document? Have you tried using the .FullName attribute of the attached
template or of the file?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Mo" <Mo(a)discussions.microsoft.com> wrote in message
news:086332A8-E7E1-40D3-9273-B00FC5EB6449(a)microsoft.com...
> Hi,
> When creating a new Word document from a library in Sharepoint and then
> saving it from Word, it suggests to save it in that same library I created
> the document from. I would like to know how Word "knows" which library to
> suggest? Can I find that information programatically?
>
> What I want to achieve is that the created document programatically
> creates
> another new document and saves it to the same library as the original
> document was created from. And I don't intend to save the first created
> document. I know how to do this except to find the path to the library.
>
> Any help is highly appreciated,
>
> Peeter

From: Mo on
Hi and thanks,

The document is, and could be, created from any document library in SP2010.
There is a content type that has a .dotm as the template for that content
type.

When you create a new document from within SP2010, it opens up in Word as
"Document 1" and it doesn't yet have any name, so any .path or .fullname
doesn't work.

I have browsed through the xml of the document, both internally via
..WordOpenXML property and externally by examining the .zip structure, but
haven't found any references ther to the document library the document is
created from.

Somehow there is a connection, because when you save the document, Word
proposes the correct document library. It seems like there is an event
handler in SP2010 that has a handle to to the document. Is there any way to
"take over" that handle to the newly created document?

In Word, if you save the first created document, the one that I don't want,
and then save the second document - the one created via code in the first
document, Word remembers the last save and suggests the same document
library. But I don't want to save the first document, so that is not an
option.

TIA,
Peeter

"Doug Robbins - Word MVP" wrote:

> How is the document actually being created? From a template or by opening a
> document? Have you tried using the .FullName attribute of the attached
> template or of the file?
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
>
> "Mo" <Mo(a)discussions.microsoft.com> wrote in message
> news:086332A8-E7E1-40D3-9273-B00FC5EB6449(a)microsoft.com...
> > Hi,
> > When creating a new Word document from a library in Sharepoint and then
> > saving it from Word, it suggests to save it in that same library I created
> > the document from. I would like to know how Word "knows" which library to
> > suggest? Can I find that information programatically?
> >
> > What I want to achieve is that the created document programatically
> > creates
> > another new document and saves it to the same library as the original
> > document was created from. And I don't intend to save the first created
> > document. I know how to do this except to find the path to the library.
> >
> > Any help is highly appreciated,
> >
> > Peeter
>
> .
>
From: Doug Robbins - Word MVP on
Does the document have a template attached to it, other than the Normal
Template?

What is displayed if you run a macro containing the following code on such a
document?

Set myTemplate = ActiveDocument.AttachedTemplate
MsgBox myTemplate.Path & Application.PathSeparator _
& myTemplate.Name


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Mo" <Mo(a)discussions.microsoft.com> wrote in message
news:76C40307-4491-4017-A72B-B9FC2504C53C(a)microsoft.com...
> Hi and thanks,
>
> The document is, and could be, created from any document library in
> SP2010.
> There is a content type that has a .dotm as the template for that content
> type.
>
> When you create a new document from within SP2010, it opens up in Word as
> "Document 1" and it doesn't yet have any name, so any .path or .fullname
> doesn't work.
>
> I have browsed through the xml of the document, both internally via
> .WordOpenXML property and externally by examining the .zip structure, but
> haven't found any references ther to the document library the document is
> created from.
>
> Somehow there is a connection, because when you save the document, Word
> proposes the correct document library. It seems like there is an event
> handler in SP2010 that has a handle to to the document. Is there any way
> to
> "take over" that handle to the newly created document?
>
> In Word, if you save the first created document, the one that I don't
> want,
> and then save the second document - the one created via code in the first
> document, Word remembers the last save and suggests the same document
> library. But I don't want to save the first document, so that is not an
> option.
>
> TIA,
> Peeter
>
> "Doug Robbins - Word MVP" wrote:
>
>> How is the document actually being created? From a template or by
>> opening a
>> document? Have you tried using the .FullName attribute of the attached
>> template or of the file?
>>
>> --
>> Hope this helps.
>>
>> Please reply to the newsgroup unless you wish to avail yourself of my
>> services on a paid consulting basis.
>>
>> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
>>
>> "Mo" <Mo(a)discussions.microsoft.com> wrote in message
>> news:086332A8-E7E1-40D3-9273-B00FC5EB6449(a)microsoft.com...
>> > Hi,
>> > When creating a new Word document from a library in Sharepoint and then
>> > saving it from Word, it suggests to save it in that same library I
>> > created
>> > the document from. I would like to know how Word "knows" which library
>> > to
>> > suggest? Can I find that information programatically?
>> >
>> > What I want to achieve is that the created document programatically
>> > creates
>> > another new document and saves it to the same library as the original
>> > document was created from. And I don't intend to save the first created
>> > document. I know how to do this except to find the path to the library.
>> >
>> > Any help is highly appreciated,
>> >
>> > Peeter
>>
>> .
>>
From: Mo on
Thanks again,

it has a template and the path to it is
"http://poweredge-r210/Documents/Forms/Sida brevmall/SP2010StartTemplate.dotm
"

/P

"Doug Robbins - Word MVP" wrote:

> Does the document have a template attached to it, other than the Normal
> Template?
>
> What is displayed if you run a macro containing the following code on such a
> document?
>
> Set myTemplate = ActiveDocument.AttachedTemplate
> MsgBox myTemplate.Path & Application.PathSeparator _
> & myTemplate.Name
>
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
>
> "Mo" <Mo(a)discussions.microsoft.com> wrote in message
> news:76C40307-4491-4017-A72B-B9FC2504C53C(a)microsoft.com...
> > Hi and thanks,
> >
> > The document is, and could be, created from any document library in
> > SP2010.
> > There is a content type that has a .dotm as the template for that content
> > type.
> >
> > When you create a new document from within SP2010, it opens up in Word as
> > "Document 1" and it doesn't yet have any name, so any .path or .fullname
> > doesn't work.
> >
> > I have browsed through the xml of the document, both internally via
> > .WordOpenXML property and externally by examining the .zip structure, but
> > haven't found any references ther to the document library the document is
> > created from.
> >
> > Somehow there is a connection, because when you save the document, Word
> > proposes the correct document library. It seems like there is an event
> > handler in SP2010 that has a handle to to the document. Is there any way
> > to
> > "take over" that handle to the newly created document?
> >
> > In Word, if you save the first created document, the one that I don't
> > want,
> > and then save the second document - the one created via code in the first
> > document, Word remembers the last save and suggests the same document
> > library. But I don't want to save the first document, so that is not an
> > option.
> >
> > TIA,
> > Peeter
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> >> How is the document actually being created? From a template or by
> >> opening a
> >> document? Have you tried using the .FullName attribute of the attached
> >> template or of the file?
> >>
> >> --
> >> Hope this helps.
> >>
> >> Please reply to the newsgroup unless you wish to avail yourself of my
> >> services on a paid consulting basis.
> >>
> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
> >>
> >> "Mo" <Mo(a)discussions.microsoft.com> wrote in message
> >> news:086332A8-E7E1-40D3-9273-B00FC5EB6449(a)microsoft.com...
> >> > Hi,
> >> > When creating a new Word document from a library in Sharepoint and then
> >> > saving it from Word, it suggests to save it in that same library I
> >> > created
> >> > the document from. I would like to know how Word "knows" which library
> >> > to
> >> > suggest? Can I find that information programatically?
> >> >
> >> > What I want to achieve is that the created document programatically
> >> > creates
> >> > another new document and saves it to the same library as the original
> >> > document was created from. And I don't intend to save the first created
> >> > document. I know how to do this except to find the path to the library.
> >> >
> >> > Any help is highly appreciated,
> >> >
> >> > Peeter
> >>
> >> .
> >>