I am wanting to find out the code for file name. I have
documents that need a copy automatically saved to a
different location on close (for intranet purposes) but am
unsure how to save the doc as it's original name (where
the ???? are below). The coding I have so far is:

Private Sub Document_Close()

Dim Save2Intranet As Boolean
Save2Intranet = MsgBox("You are about to close. Do you
wish to save a copy to the intranet?", vbYesNo) = vbYes
If Save2Intranet Then
Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"
& ????, wdFormatFilteredHTML
End If
End Sub

Thanks

Re: File Path Name by Jezebel

Jezebel
Tue Jan 27 18:49:09 CST 2004

If the document has been saved already, you can use ActiveDocument.Name. If
it's never been saved this returns 'Document1' (or whatever number you're up
to).

Your code uses the 'me' keyword -- this doesn't work in VBA as a reference
to the ActiveDocument.




"Lee" <anonymous@discussions.microsoft.com> wrote in message
news:4fda01c3e533$e12e0c10$a301280a@phx.gbl...
> I am wanting to find out the code for file name. I have
> documents that need a copy automatically saved to a
> different location on close (for intranet purposes) but am
> unsure how to save the doc as it's original name (where
> the ???? are below). The coding I have so far is:
>
> Private Sub Document_Close()
>
> Dim Save2Intranet As Boolean
> Save2Intranet = MsgBox("You are about to close. Do you
> wish to save a copy to the intranet?", vbYesNo) = vbYes
> If Save2Intranet Then
> Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"
> & ????, wdFormatFilteredHTML
> End If
> End Sub
>
> Thanks



Re: File Path Name by Peter

Peter
Tue Jan 27 18:50:35 CST 2004

Hi Lee

As long as it's always the ActiveDcoument you're saving you could replace
???? with "ActiveDocument.Name". If it's not always the ActiveDcoument you're
saving you should pass the name of the file to the procedure, something like:

Public Sub SaveToIntranet(ByVal strFilename As String)
Dim Save2Intranet As Boolean

Save2Intranet = MsgBox("You are about to close. " & _
"Do you wish to save a copy to the intranet?", vbYesNo) = vbYes
If Save2Intranet Then
Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\" & _
strFilename, wdFormatFilteredHTML
End If
End Sub

You'd call the procedure using something like:

Dim docImUsing As Word.Document

SaveToIntranet docImUsing.Name

HTH + Cheers - Peter

"Lee" <anonymous@discussions.microsoft.com> wrote in news:4fda01c3e533
$e12e0c10$a301280a@phx.gbl:

> I am wanting to find out the code for file name. I have
> documents that need a copy automatically saved to a
> different location on close (for intranet purposes) but am
> unsure how to save the doc as it's original name (where
> the ???? are below). The coding I have so far is:
>
> Private Sub Document_Close()
>
> Dim Save2Intranet As Boolean
> Save2Intranet = MsgBox("You are about to close. Do you
> wish to save a copy to the intranet?", vbYesNo) = vbYes
> If Save2Intranet Then
> Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"
> & ????, wdFormatFilteredHTML
> End If
> End Sub
>
> Thanks
>


File Path Name by Lee

Lee
Tue Jan 27 18:51:18 CST 2004

Hi

I have worked it out... file name coding =
ActiveDocument.Name BUT it will not save it as filtered
HTML (wdFormatFilteredHTML)....

So the coding I have is:

Private Sub Document_Close()

Dim Save2Intranet As Boolean
Save2Intranet = MsgBox("You are about to close. Do you
wish to save a copy to the intranet?", vbYesNo) = vbYes
If Save2Intranet Then
Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"
& ActiveDocument.Name, wdFormatFilteredHTML
End If
End Sub


>-----Original Message-----
>I am wanting to find out the code for file name. I have
>documents that need a copy automatically saved to a
>different location on close (for intranet purposes) but
am
>unsure how to save the doc as it's original name (where
>the ???? are below). The coding I have so far is:
>
>Private Sub Document_Close()
>
>Dim Save2Intranet As Boolean
>Save2Intranet = MsgBox("You are about to close. Do you
>wish to save a copy to the intranet?", vbYesNo) = vbYes
>If Save2Intranet Then
>Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"

>& ????, wdFormatFilteredHTML
>End If
>End Sub
>
>Thanks
>.
>

Re: File Path Name by Peter

Peter
Tue Jan 27 18:58:48 CST 2004

Peter Hewett <Nospam@xtra.co.nz> wrote in
news:Xns947E8CD394E34Iwlpth@207.46.248.16:
Hi Lee

Please ignore that last post I'm having a bad-brain day! Here's what you
need to do:

Public Sub SaveToIntranet(ByVal docToSave As Word.Document)
Dim Save2Intranet As Boolean

Save2Intranet = MsgBox("You are about to close. " & _
"Do you wish to save a copy to the intranet?", vbYesNo) = vbYes
If Save2Intranet Then
docToSave.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\" & _
strFilename, wdFormatFilteredHTML
End If
End Sub

Always call the above procedure using either:

SavetoIntranet ActiveDocument

or if it's another document you want to save, that you've already got a
document object reference for, use something like:

Dim docImUsing As Word.Document

SaveToIntranet docImUsing.Name

Sorry about that + Cheers - Peter


> Hi Lee
>
> As long as it's always the ActiveDcoument you're saving you could
> replace ???? with "ActiveDocument.Name". If it's not always the
> ActiveDcoument you're saving you should pass the name of the file to the
> procedure, something like:
>
> Public Sub SaveToIntranet(ByVal strFilename As String)
> Dim Save2Intranet As Boolean
>
> Save2Intranet = MsgBox("You are about to close. " & _
> "Do you wish to save a copy to the intranet?", vbYesNo) =
> vbYes
> If Save2Intranet Then
> Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\" & _
> strFilename, wdFormatFilteredHTML
> End If
> End Sub
>
> You'd call the procedure using something like:
>
> Dim docImUsing As Word.Document
>
> SaveToIntranet docImUsing.Name
>
> HTH + Cheers - Peter
>
> "Lee" <anonymous@discussions.microsoft.com> wrote in news:4fda01c3e533
> $e12e0c10$a301280a@phx.gbl:
>
>> I am wanting to find out the code for file name. I have
>> documents that need a copy automatically saved to a
>> different location on close (for intranet purposes) but am
>> unsure how to save the doc as it's original name (where
>> the ???? are below). The coding I have so far is:
>>
>> Private Sub Document_Close()
>>
>> Dim Save2Intranet As Boolean
>> Save2Intranet = MsgBox("You are about to close. Do you
>> wish to save a copy to the intranet?", vbYesNo) = vbYes
>> If Save2Intranet Then
>> Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"
>> & ????, wdFormatFilteredHTML
>> End If
>> End Sub
>>
>> Thanks
>>
>
>


Re: File Path Name by Peter

Peter
Tue Jan 27 19:13:57 CST 2004

Hi Lee

That'll teach me to try out the code before posting try this:

Public Sub SaveToIntranet(ByVal docToSave As Word.Document)
Dim Save2Intranet As Boolean

Save2Intranet = MsgBox("You are about to close. " & _
"Do you wish to save a copy to the intranet?", vbYesNo) = vbYes
If Save2Intranet Then
docToSave.SaveAs ""\\ruth\inetpub\wwwroot\apps\news\newsreleases\" & _
docToSave.Name, wdFormatHTML
End If
End Sub

Sorry about all this - It REALLY is bad-brain day!


Peter Hewett <Nospam@xtra.co.nz> wrote in news:Xns947E8E37B12DAIwlpth@
207.46.248.16:

> Peter Hewett <Nospam@xtra.co.nz> wrote in
> news:Xns947E8CD394E34Iwlpth@207.46.248.16:
> Hi Lee
>
> Please ignore that last post I'm having a bad-brain day! Here's what you
> need to do:
>
> Public Sub SaveToIntranet(ByVal docToSave As Word.Document)
> Dim Save2Intranet As Boolean
>
> Save2Intranet = MsgBox("You are about to close. " & _
> "Do you wish to save a copy to the intranet?", vbYesNo) = vbYes
> If Save2Intranet Then
> docToSave.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\" & _
> strFilename, wdFormatFilteredHTML
> End If
> End Sub
>
> Always call the above procedure using either:
>
> SavetoIntranet ActiveDocument
>
> or if it's another document you want to save, that you've already got a
> document object reference for, use something like:
>
> Dim docImUsing As Word.Document
>
> SaveToIntranet docImUsing.Name
>
> Sorry about that + Cheers - Peter
>
>
>> Hi Lee
>>
>> As long as it's always the ActiveDcoument you're saving you could
>> replace ???? with "ActiveDocument.Name". If it's not always the
>> ActiveDcoument you're saving you should pass the name of the file to the
>> procedure, something like:
>>
>> Public Sub SaveToIntranet(ByVal strFilename As String)
>> Dim Save2Intranet As Boolean
>>
>> Save2Intranet = MsgBox("You are about to close. " & _
>> "Do you wish to save a copy to the intranet?", vbYesNo) =
>> vbYes
>> If Save2Intranet Then
>> Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\" & _
>> strFilename, wdFormatFilteredHTML
>> End If
>> End Sub
>>
>> You'd call the procedure using something like:
>>
>> Dim docImUsing As Word.Document
>>
>> SaveToIntranet docImUsing.Name
>>
>> HTH + Cheers - Peter
>>
>> "Lee" <anonymous@discussions.microsoft.com> wrote in news:4fda01c3e533
>> $e12e0c10$a301280a@phx.gbl:
>>
>>> I am wanting to find out the code for file name. I have
>>> documents that need a copy automatically saved to a
>>> different location on close (for intranet purposes) but am
>>> unsure how to save the doc as it's original name (where
>>> the ???? are below). The coding I have so far is:
>>>
>>> Private Sub Document_Close()
>>>
>>> Dim Save2Intranet As Boolean
>>> Save2Intranet = MsgBox("You are about to close. Do you
>>> wish to save a copy to the intranet?", vbYesNo) = vbYes
>>> If Save2Intranet Then
>>> Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"
>>> & ????, wdFormatFilteredHTML
>>> End If
>>> End Sub
>>>
>>> Thanks
>>>
>>
>>
>
>


Re: File Path Name by Charles

Charles
Tue Jan 27 19:46:02 CST 2004

One other concern is that your code does not save to the hard drive first.
You may end up with different variations on your intranet than on the
originator's hard drive.
--

Charles Kenyon

See the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

"Lee" <anonymous@discussions.microsoft.com> wrote in message
news:4fda01c3e533$e12e0c10$a301280a@phx.gbl...
> I am wanting to find out the code for file name. I have
> documents that need a copy automatically saved to a
> different location on close (for intranet purposes) but am
> unsure how to save the doc as it's original name (where
> the ???? are below). The coding I have so far is:
>
> Private Sub Document_Close()
>
> Dim Save2Intranet As Boolean
> Save2Intranet = MsgBox("You are about to close. Do you
> wish to save a copy to the intranet?", vbYesNo) = vbYes
> If Save2Intranet Then
> Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"
> & ????, wdFormatFilteredHTML
> End If
> End Sub
>
> Thanks



Re: File Path Name by Lee

Lee
Wed Jan 28 16:55:01 CST 2004

I have written other code that runs when the user fills in
a user form and this code saves the original to another
place (e.g. on a network) so the document is already
saved. We do not have harddrives as we use dumb terminals
due to being on a network....

>-----Original Message-----
>One other concern is that your code does not save to the
hard drive first.
>You may end up with different variations on your intranet
than on the
>originator's hard drive.
>--
>
>Charles Kenyon
>
>See the MVP FAQ: <URL: http://www.mvps.org/word/> which
is awesome!
> --------- --------- --------- --------- --------- -------
--
>This message is posted to a newsgroup. Please post replies
>and questions to the newsgroup so that others can learn
>from my ignorance and your wisdom.
>
>"Lee" <anonymous@discussions.microsoft.com> wrote in
message
>news:4fda01c3e533$e12e0c10$a301280a@phx.gbl...
>> I am wanting to find out the code for file name. I have
>> documents that need a copy automatically saved to a
>> different location on close (for intranet purposes) but
am
>> unsure how to save the doc as it's original name (where
>> the ???? are below). The coding I have so far is:
>>
>> Private Sub Document_Close()
>>
>> Dim Save2Intranet As Boolean
>> Save2Intranet = MsgBox("You are about to close. Do you
>> wish to save a copy to the intranet?", vbYesNo) = vbYes
>> If Save2Intranet Then
>>
Me.SaveAs "\\ruth\inetpub\wwwroot\apps\news\newsreleases\"
>> & ????, wdFormatFilteredHTML
>> End If
>> End Sub
>>
>> Thanks
>
>
>.
>