Reply
 
Thread Tools Display Modes
  #1   Report Post  
Steve
 
Posts: n/a
Default Includetext Source Path Office 2003

I am trying "NOT" to include a path name in my fields. I want to keep
all my documents in one folder without typing in the path for the
document. I read on previous postings that it is possible in Office
2000 do do this. I am having problems with this.

I keep getting: {INCLUDETEXT "Lease.doc" \!} --- my code
Error! Not a valid filename. --- result
When I include the path "c:\\template\\Lease.doc" there is no problem.
I have office 2003 and I am having problems getting it to work without
a path. The reason I need this done is I have a document I am sending
to someone and I don't want the path from my computer appearing in the
field.

Is there something I am typing wrong?

Thanks

Steve
  #2   Report Post  
macropod
 
Posts: n/a
Default

Hi Steve,

In Word 2000, at least, the full path isn't necessary. However, the full
path is still stored in the document's meta data, and the INCLUDETEXT field
will still use that path, even in Word 2003.

One implication for this in what you're trying to do is that, if you send
only the 'target' document, the recipient won't be able to see the 'source'
document's included text - they'll simply get the same 'Error! Not a valid
filename' you're getting now. To overcome this, you might like to convert
the included text to standard text (via Ctrl-Shift-F9) and save that version
of the document under a new filename for sending. Doing this removes all
links to the 'source' document.

Cheers


"Steve" wrote in message
om...
I am trying "NOT" to include a path name in my fields. I want to keep
all my documents in one folder without typing in the path for the
document. I read on previous postings that it is possible in Office
2000 do do this. I am having problems with this.

I keep getting: {INCLUDETEXT "Lease.doc" \!} --- my code
Error! Not a valid filename. --- result
When I include the path "c:\\template\\Lease.doc" there is no problem.
I have office 2003 and I am having problems getting it to work without
a path. The reason I need this done is I have a document I am sending
to someone and I don't want the path from my computer appearing in the
field.

Is there something I am typing wrong?

Thanks

Steve



  #3   Report Post  
Steve
 
Posts: n/a
Default

"macropod" wrote in message ...
Hi Steve,

In Word 2000, at least, the full path isn't necessary. However, the full
path is still stored in the document's meta data, and the INCLUDETEXT field
will still use that path, even in Word 2003.

One implication for this in what you're trying to do is that, if you send
only the 'target' document, the recipient won't be able to see the 'source'
document's included text - they'll simply get the same 'Error! Not a valid
filename' you're getting now. To overcome this, you might like to convert
the included text to standard text (via Ctrl-Shift-F9) and save that version
of the document under a new filename for sending. Doing this removes all
links to the 'source' document.

Cheers


"Steve" wrote in message
om...
I am trying "NOT" to include a path name in my fields. I want to keep
all my documents in one folder without typing in the path for the
document. I read on previous postings that it is possible in Office
2000 do do this. I am having problems with this.

I keep getting: {INCLUDETEXT "Lease.doc" \!} --- my code
Error! Not a valid filename. --- result
When I include the path "c:\\template\\Lease.doc" there is no problem.
I have office 2003 and I am having problems getting it to work without
a path. The reason I need this done is I have a document I am sending
to someone and I don't want the path from my computer appearing in the
field.

Is there something I am typing wrong?

Thanks

Steve


Thank you for the info on this I will need this tip as well. What I
have is a template with linked documents. I am creating this template
and linked documents on my computer. I will then send this template
and the linked documents all in one folder to another user. When the
user opens the template that has the linked documents it returns the
Error! Not a valid filename.

Is this possible in 2003 to have the source and linked docs contained
in one folder and exclude the path name in the includetext field?

Steve
  #4   Report Post  
macropod
 
Posts: n/a
Default

Hi Steve,

If you can keep the Word document and the included ones in the same folder
for distribution (whether by email or on a CD, for exmple), you could use
the following vba code to automatically update the INCLUDETEXT filed paths
whenever the document is opened.

Cheers
PS: e-mailing might break the longer lines. If this causes problems for you
in restoring them correctly, post back and I'll let you know which ones need
fixing.

Option Explicit
Public TFilePath As String, SFileName As String

Private Sub UpdatePath()
' This code defaults to the same path as the target document,
' using the simple expedient of creating,
' copying, then destroying a FILENAME/p field.
Dim CharPos As Integer, TFilePathLength As Integer
With Selection
.Collapse Direction:=wdCollapseStart
.Fields.Add Range:=Selection.Range, Type:=wdFieldFileName, _
Text:="\p"
.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
End With
TFilePath = Selection
TFilePathLength = Len(TFilePath)
For CharPos = TFilePathLength To 0 Step -1
If Mid(TFilePath, CharPos, 1) = "\" Then
TFilePath = Mid(TFilePath, 1, CharPos)
Exit For
End If
Next CharPos
Selection.Delete
' Insert the required \\s and 'INCLUDETEXT "' prefix for the string
TFilePath = Replace$(TFilePath, "\", "\\")
TFilePath = "INCLUDETEXT " & """" & TFilePath
End Sub

Private Sub GetSourceFileName()
' This routine gets the source filename, plus any bookmarks
' and switches from the original field.
Dim CharPos As Integer, SFilePathLength As Integer
SFileName = Selection
SFilePathLength = Len(SFileName)
For CharPos = SFilePathLength To 0 Step -1
On Error Resume Next 'In case there's no path
If Mid(SFileName, CharPos, 2) = "\\" Then
SFileName = Mid(SFileName, CharPos + 2)
Exit For
End If
Next CharPos
' The next two lines stop the new field from gaining extra spaces.
SFileName = Replace$(SFileName, " " & Chr(21), Chr(21))
SFileName = Replace$(SFileName, Chr(21), "")
End Sub

Sub AutoOpen()
Dim FieldCount As Integer, Found As Boolean, NewField As String
Selection.HomeKey Unit:=wdStory
ActiveWindow.View.ShowFieldCodes = False
Call UpdatePath
ActiveWindow.View.ShowFieldCodes = True
' Go through the document, updating all INCLUDETEXT fields
' with the new path.
If ActiveDocument.Fields.Count 0 Then
For FieldCount = ActiveDocument.Fields.Count To 1 Step -1
ActiveDocument.Fields(FieldCount).Select
If InStr(1, Selection.Fields(1).Code, "INCLUDETEXT", 1) Then
Selection.Copy
Call GetSourceFileName
NewField = TFilePath & SFileName
With Selection
.Delete
.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
Text:=NewField, PreserveFormatting:=False
End With
End If
Next
End If
ActiveWindow.View.ShowFieldCodes = False
ActiveDocument.Saved = True
End Sub


"Steve" wrote in message
om...
"macropod" wrote in message

...
Hi Steve,

In Word 2000, at least, the full path isn't necessary. However, the full
path is still stored in the document's meta data, and the INCLUDETEXT

field
will still use that path, even in Word 2003.

One implication for this in what you're trying to do is that, if you

send
only the 'target' document, the recipient won't be able to see the

'source'
document's included text - they'll simply get the same 'Error! Not a

valid
filename' you're getting now. To overcome this, you might like to

convert
the included text to standard text (via Ctrl-Shift-F9) and save that

version
of the document under a new filename for sending. Doing this removes all
links to the 'source' document.

Cheers


"Steve" wrote in message
om...
I am trying "NOT" to include a path name in my fields. I want to keep
all my documents in one folder without typing in the path for the
document. I read on previous postings that it is possible in Office
2000 do do this. I am having problems with this.

I keep getting: {INCLUDETEXT "Lease.doc" \!} --- my code
Error! Not a valid filename. --- result
When I include the path "c:\\template\\Lease.doc" there is no problem.
I have office 2003 and I am having problems getting it to work without
a path. The reason I need this done is I have a document I am sending
to someone and I don't want the path from my computer appearing in the
field.

Is there something I am typing wrong?

Thanks

Steve


Thank you for the info on this I will need this tip as well. What I
have is a template with linked documents. I am creating this template
and linked documents on my computer. I will then send this template
and the linked documents all in one folder to another user. When the
user opens the template that has the linked documents it returns the
Error! Not a valid filename.

Is this possible in 2003 to have the source and linked docs contained
in one folder and exclude the path name in the includetext field?

Steve



  #5   Report Post  
Steve
 
Posts: n/a
Default

That's great I will give it a try.

Thanks again.

Steve


"macropod" wrote in message ...
Hi Steve,

If you can keep the Word document and the included ones in the same folder
for distribution (whether by email or on a CD, for exmple), you could use
the following vba code to automatically update the INCLUDETEXT filed paths
whenever the document is opened.

Cheers
PS: e-mailing might break the longer lines. If this causes problems for you
in restoring them correctly, post back and I'll let you know which ones need
fixing.

Option Explicit
Public TFilePath As String, SFileName As String

Private Sub UpdatePath()
' This code defaults to the same path as the target document,
' using the simple expedient of creating,
' copying, then destroying a FILENAME/p field.
Dim CharPos As Integer, TFilePathLength As Integer
With Selection
.Collapse Direction:=wdCollapseStart
.Fields.Add Range:=Selection.Range, Type:=wdFieldFileName, _
Text:="\p"
.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
End With
TFilePath = Selection
TFilePathLength = Len(TFilePath)
For CharPos = TFilePathLength To 0 Step -1
If Mid(TFilePath, CharPos, 1) = "\" Then
TFilePath = Mid(TFilePath, 1, CharPos)
Exit For
End If
Next CharPos
Selection.Delete
' Insert the required \\s and 'INCLUDETEXT "' prefix for the string
TFilePath = Replace$(TFilePath, "\", "\\")
TFilePath = "INCLUDETEXT " & """" & TFilePath
End Sub

Private Sub GetSourceFileName()
' This routine gets the source filename, plus any bookmarks
' and switches from the original field.
Dim CharPos As Integer, SFilePathLength As Integer
SFileName = Selection
SFilePathLength = Len(SFileName)
For CharPos = SFilePathLength To 0 Step -1
On Error Resume Next 'In case there's no path
If Mid(SFileName, CharPos, 2) = "\\" Then
SFileName = Mid(SFileName, CharPos + 2)
Exit For
End If
Next CharPos
' The next two lines stop the new field from gaining extra spaces.
SFileName = Replace$(SFileName, " " & Chr(21), Chr(21))
SFileName = Replace$(SFileName, Chr(21), "")
End Sub

Sub AutoOpen()
Dim FieldCount As Integer, Found As Boolean, NewField As String
Selection.HomeKey Unit:=wdStory
ActiveWindow.View.ShowFieldCodes = False
Call UpdatePath
ActiveWindow.View.ShowFieldCodes = True
' Go through the document, updating all INCLUDETEXT fields
' with the new path.
If ActiveDocument.Fields.Count 0 Then
For FieldCount = ActiveDocument.Fields.Count To 1 Step -1
ActiveDocument.Fields(FieldCount).Select
If InStr(1, Selection.Fields(1).Code, "INCLUDETEXT", 1) Then
Selection.Copy
Call GetSourceFileName
NewField = TFilePath & SFileName
With Selection
.Delete
.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
Text:=NewField, PreserveFormatting:=False
End With
End If
Next
End If
ActiveWindow.View.ShowFieldCodes = False
ActiveDocument.Saved = True
End Sub


"Steve" wrote in message
om...
"macropod" wrote in message

...
Hi Steve,

In Word 2000, at least, the full path isn't necessary. However, the full
path is still stored in the document's meta data, and the INCLUDETEXT

field
will still use that path, even in Word 2003.

One implication for this in what you're trying to do is that, if you

send
only the 'target' document, the recipient won't be able to see the

'source'
document's included text - they'll simply get the same 'Error! Not a

valid
filename' you're getting now. To overcome this, you might like to

convert
the included text to standard text (via Ctrl-Shift-F9) and save that

version
of the document under a new filename for sending. Doing this removes all
links to the 'source' document.

Cheers


"Steve" wrote in message
om...
I am trying "NOT" to include a path name in my fields. I want to keep
all my documents in one folder without typing in the path for the
document. I read on previous postings that it is possible in Office
2000 do do this. I am having problems with this.

I keep getting: {INCLUDETEXT "Lease.doc" \!} --- my code
Error! Not a valid filename. --- result
When I include the path "c:\\template\\Lease.doc" there is no problem.
I have office 2003 and I am having problems getting it to work without
a path. The reason I need this done is I have a document I am sending
to someone and I don't want the path from my computer appearing in the
field.

Is there something I am typing wrong?

Thanks

Steve


Thank you for the info on this I will need this tip as well. What I
have is a template with linked documents. I am creating this template
and linked documents on my computer. I will then send this template
and the linked documents all in one folder to another user. When the
user opens the template that has the linked documents it returns the
Error! Not a valid filename.

Is this possible in 2003 to have the source and linked docs contained
in one folder and exclude the path name in the includetext field?

Steve



  #6   Report Post  
Steve
 
Posts: n/a
Default

Macropod:

This macro works great. I don't see any problems at all with it. Is
there a way I can ask the user when the document opens if they want to
run the macro? Right now it runs everytime you open the document.

Thanks again.

Steve




(Steve) wrote in message om...
That's great I will give it a try.

Thanks again.

Steve


"macropod" wrote in message ...
Hi Steve,

If you can keep the Word document and the included ones in the same folder
for distribution (whether by email or on a CD, for exmple), you could use
the following vba code to automatically update the INCLUDETEXT filed paths
whenever the document is opened.

Cheers
PS: e-mailing might break the longer lines. If this causes problems for you
in restoring them correctly, post back and I'll let you know which ones need
fixing.

Option Explicit
Public TFilePath As String, SFileName As String

Private Sub UpdatePath()
' This code defaults to the same path as the target document,
' using the simple expedient of creating,
' copying, then destroying a FILENAME/p field.
Dim CharPos As Integer, TFilePathLength As Integer
With Selection
.Collapse Direction:=wdCollapseStart
.Fields.Add Range:=Selection.Range, Type:=wdFieldFileName, _
Text:="\p"
.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
End With
TFilePath = Selection
TFilePathLength = Len(TFilePath)
For CharPos = TFilePathLength To 0 Step -1
If Mid(TFilePath, CharPos, 1) = "\" Then
TFilePath = Mid(TFilePath, 1, CharPos)
Exit For
End If
Next CharPos
Selection.Delete
' Insert the required \\s and 'INCLUDETEXT "' prefix for the string
TFilePath = Replace$(TFilePath, "\", "\\")
TFilePath = "INCLUDETEXT " & """" & TFilePath
End Sub

Private Sub GetSourceFileName()
' This routine gets the source filename, plus any bookmarks
' and switches from the original field.
Dim CharPos As Integer, SFilePathLength As Integer
SFileName = Selection
SFilePathLength = Len(SFileName)
For CharPos = SFilePathLength To 0 Step -1
On Error Resume Next 'In case there's no path
If Mid(SFileName, CharPos, 2) = "\\" Then
SFileName = Mid(SFileName, CharPos + 2)
Exit For
End If
Next CharPos
' The next two lines stop the new field from gaining extra spaces.
SFileName = Replace$(SFileName, " " & Chr(21), Chr(21))
SFileName = Replace$(SFileName, Chr(21), "")
End Sub

Sub AutoOpen()
Dim FieldCount As Integer, Found As Boolean, NewField As String
Selection.HomeKey Unit:=wdStory
ActiveWindow.View.ShowFieldCodes = False
Call UpdatePath
ActiveWindow.View.ShowFieldCodes = True
' Go through the document, updating all INCLUDETEXT fields
' with the new path.
If ActiveDocument.Fields.Count 0 Then
For FieldCount = ActiveDocument.Fields.Count To 1 Step -1
ActiveDocument.Fields(FieldCount).Select
If InStr(1, Selection.Fields(1).Code, "INCLUDETEXT", 1) Then
Selection.Copy
Call GetSourceFileName
NewField = TFilePath & SFileName
With Selection
.Delete
.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
Text:=NewField, PreserveFormatting:=False
End With
End If
Next
End If
ActiveWindow.View.ShowFieldCodes = False
ActiveDocument.Saved = True
End Sub


"Steve" wrote in message
om...
"macropod" wrote in message

...
Hi Steve,

In Word 2000, at least, the full path isn't necessary. However, the full
path is still stored in the document's meta data, and the INCLUDETEXT

field
will still use that path, even in Word 2003.

One implication for this in what you're trying to do is that, if you

send
only the 'target' document, the recipient won't be able to see the

'source'
document's included text - they'll simply get the same 'Error! Not a

valid
filename' you're getting now. To overcome this, you might like to

convert
the included text to standard text (via Ctrl-Shift-F9) and save that

version
of the document under a new filename for sending. Doing this removes all
links to the 'source' document.

Cheers


"Steve" wrote in message
om...
I am trying "NOT" to include a path name in my fields. I want to keep
all my documents in one folder without typing in the path for the
document. I read on previous postings that it is possible in Office
2000 do do this. I am having problems with this.

I keep getting: {INCLUDETEXT "Lease.doc" \!} --- my code
Error! Not a valid filename. --- result
When I include the path "c:\\template\\Lease.doc" there is no problem.
I have office 2003 and I am having problems getting it to work without
a path. The reason I need this done is I have a document I am sending
to someone and I don't want the path from my computer appearing in the
field.

Is there something I am typing wrong?

Thanks

Steve

Thank you for the info on this I will need this tip as well. What I
have is a template with linked documents. I am creating this template
and linked documents on my computer. I will then send this template
and the linked documents all in one folder to another user. When the
user opens the template that has the linked documents it returns the
Error! Not a valid filename.

Is this possible in 2003 to have the source and linked docs contained
in one folder and exclude the path name in the includetext field?

Steve

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Office 2000 Word Saved Document & Need to read in Office 2003 Word Hawk Indoor air, Inc. Microsoft Word Help 1 March 18th 05 07:32 PM
After upgrade from office 2000 to office 2003 Graphic Appears as . Officeguy Microsoft Word Help 0 February 8th 05 02:55 AM
Microsoft Office Word 2003 Sharon Microsoft Word Help 1 January 16th 05 09:13 PM
merging Word 2000 data source and word 2003 envelopes Jini Mailmerge 1 December 2nd 04 10:48 PM
Merge Data Source path Peter Jamieson Mailmerge 0 November 25th 04 07:15 PM


All times are GMT +1. The time now is 09:25 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"