Bestand opslaan met als bestandsnaam een variabele

Status
Niet open voor verdere reacties.

fotofons

Gebruiker
Lid geworden
2 aug 2007
Berichten
100
Ik heb hetvolgende in een macro staan:
Selection.Copy
sVar = Selection.Text
Windows("1213-n234-internet").Activate
ActiveDocument.SaveAs2 FileName:="pietje.docx", _
FileFormat:=wdFormatXMLDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData _
:=False, SaveAsAOCELetter:=False, CompatibilityMode:=14

Als ik bij de bestandsnaam "pietje.docx" vervang door sVar & ".docx" loopt het macro vast. Foutcode 5487
Wat doe ik fout?
 
Laatst bewerkt:
5487 zegt dat je geen toestemming hebt.
Gaat het met "pietje.docx" wel goed?
 
Probeer 'm zo eens:
Code:
sVar = Selection.Text & ".docx"
Windows("1213-n234-internet").Activate
ActiveDocument.SaveAs2 FileName:=sVar, FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=True, CompatibilityMode:=14
 
Probeer 'm zo eens:
Code:
sVar = Selection.Text & ".docx"
Windows("1213-n234-internet").Activate
ActiveDocument.SaveAs2 FileName:=sVar, FileFormat:=wdFormatXMLDocument, AddToRecentFiles:=True, CompatibilityMode:=14

Nog steeds hetzelfde probleem
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan