Word 2007 : error message executing a macro

C

Céline Brien

Hi everybody,

I wrote a macro which is functioning perfectly on my computer.

I open a document called PV_reso.docm and execute the macro creating another
document called pv_registre.docx.

The first document is save in G:\01 Conseil\01-06 Document Reliés

The second document is save on C:\

On my computer, I use an external hard disk to reproduce the path of the
other computer.

On the other computer, the path is on a server.

On the other computer, the execution of the macro generate the following
error message :

---------------------------------

G:\01 Conseil\01-06 Document Reliés\PV_Reso.docm cannot be find. Check
spelling or try another path.

---------------------------------
The spelling is correct. We check it many times.

There is no way to change the path, only and OK button.

The macro is not referring to this path and document.

As I pointed earlier, the document open when the macro is executed is
PV_Reso.docm.

I hope somebody can help, because I can't think of any solution.

Thanks,

Céline

--------------------------------------

Here are the codes of the macro called CreerPVRegistre.

Essentialy it is saving the actual document under another name and changing
the format.

--------------------------------------
Sub CreerPVRegistre()
'
'
' Créer le document PV_Registre. Macro créée par Céline Brien (819) 326-7273
en décembre 2008
'
' Désactiver l'actualisation de l'écran (exécution plus rapide de la
macro)
Application.ScreenUpdating = False
' Enregistrer le document
ActiveDocument.Save

' Enregistrer sous C:\PV_Registre.docx
ChangeFileOpenDirectory "C:\"
ActiveDocument.SaveAs FileName:="PV_Registre.docx", FileFormat:= _
wdFormatXMLDocument, LockComments:=False, Password:="",
AddToRecentFiles _
:=True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts _
:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
With ActiveDocument.Styles(wdStyleNormal).Font
If .NameFarEast = .NameAscii Then
.NameAscii = ""
End If
.NameFarEast = ""
End With
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = CentimetersToPoints(2.54)
.BottomMargin = CentimetersToPoints(1.27)
.LeftMargin = CentimetersToPoints(1)
.RightMargin = CentimetersToPoints(1)
.Gutter = CentimetersToPoints(2.1)
.HeaderDistance = CentimetersToPoints(1.27)
.FooterDistance = CentimetersToPoints(1.27)
.PageWidth = CentimetersToPoints(21.59)
.PageHeight = CentimetersToPoints(35.56)
.FirstPageTray = wdPrinterDefaultBin
.OtherPagesTray = wdPrinterDefaultBin
.SectionStart = wdSectionNewPage
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.VerticalAlignment = wdAlignVerticalTop
.SuppressEndnotes = False
.MirrorMargins = True
.TwoPagesOnOne = False
.BookFoldPrinting = False
.BookFoldRevPrinting = False
.BookFoldPrintingSheets = 1
.GutterPos = wdGutterPosLeft
End With
With ActiveDocument.Styles("À Transfert budgétaire").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("ATTENDU").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("Autres").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("CONSIDÉRANT").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("DE Transfert budgétaire").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("ET QUE").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("Il est proposé par").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
.TextboxTightWrap = wdTightNone
End With
With ActiveDocument.Styles("Normal").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("QU").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("QUE").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
End With
With ActiveDocument.Styles("No résolution").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.4)
.FirstLineIndent = CentimetersToPoints(-3.4)
End With
ActiveDocument.Styles("No
résolution").ParagraphFormat.TabStops.ClearAll
ActiveDocument.Styles("No résolution").ParagraphFormat.TabStops.Add
_
Position:=CentimetersToPoints(3.4), Alignment:=wdAlignTabLeft,
Leader:= _
wdTabLeaderSpaces
With ActiveDocument.Styles("TM 1").ParagraphFormat
.LeftIndent = CentimetersToPoints(4.55)
.FirstLineIndent = CentimetersToPoints(-1.15)
End With
With ActiveDocument.Styles("TM 2").ParagraphFormat
.LeftIndent = CentimetersToPoints(5.95)
.FirstLineIndent = CentimetersToPoints(-1.45)
End With
With ActiveDocument.Styles("SignatureJean").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.2)
End With
With ActiveDocument.Styles("Guillemets").ParagraphFormat
.LeftIndent = CentimetersToPoints(3.77)
.FirstLineIndent = CentimetersToPoints(-0.37)
End With
With ActiveDocument.Styles("Trait").ParagraphFormat
.LeftIndent = CentimetersToPoints(4.66)
.FirstLineIndent = CentimetersToPoints(-1.03)
End With
ActiveDocument.Styles("Trait").ParagraphFormat.TabStops.Add Position:= _
CentimetersToPoints(4.66), Alignment:=wdAlignTabLeft, Leader:= _
wdTabLeaderSpaces
With ActiveDocument.Styles("SignatureJean").ParagraphFormat
.LeftIndent = CentimetersToPoints(9)
End With

' Activer l'actualisation de l'écran
Application.ScreenUpdating = True

End Sub
 
C

Céline Brien

Hi,
Finally we change the path when saving pv_registre.docx.
We changed it from C:\ to G:\01 Conseil\01-08 Registre.
It was as if we could'nt save on the C:\ drive.
Still don't understand the error message :
"G:\01 Conseil\01-06 Document Reliés\PV_Reso.docm cannot be find. Check
spelling or try another path."
Because the macro being executed when it appear is not referring to this
path and document
Have a good day,
Céline
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top