![]() |
|
#1
|
|||
|
|||
|
Run-time Error (5487)
word cannot complete the save due to a file permission error Code:
Dim str1 As String, str2 As String
With ActiveDocument
.Select
With Selection
.Find.ClearFormatting
.Find.Execute FindText:="The Principal", MatchWholeWord:=True
.HomeKey
.MoveDown
.EndKey Unit:=wdLine
.MoveLeft Unit:=wdCharacter, Count:=1
.HomeKey Unit:=wdLine, Extend:=wdExtend
str1 = Trim(Selection.Range.Text)
End With
.Select
With Selection
.Find.Execute FindText:="RE: ", MatchWholeWord:=True
.MoveRight Unit:=wdCharacter, Count:=1
.EndKey Unit:=wdLine, Extend:=wdExtend
str2 = Trim(Selection.Range.Text)
End With
.SaveAs2 FileName:=ThisDocument.Path & "\" & str1 & " " & str2, FileFormat:=wdFormatDocumentDefault
End With
I don't know why str2 causes the problem to saving the document. 14 April 2012.docx Many thanks in advance. |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Word Visual Basic error - run time error 504 | crazymorton | Word | 11 | 01-13-2012 04:32 AM |
Microsoft office 2010 error 2908 and error 1935 !!!!!!heeeeellpppp!!!!!!!!!
|
bennypryde | Office | 1 | 01-05-2012 03:33 PM |
| Ms Word Error | manesh | Word | 1 | 05-28-2010 07:26 AM |
| Runtime error 5487 - Word cannot complete the save to to file permission error | franferns | Word | 0 | 11-25-2009 05:35 AM |
| Receive error cannot open this form because an error occurred in BCM 2007 | bornhusker | Outlook | 0 | 06-01-2009 10:28 AM |