Share via

File SaveAs VBA code not working.

Anonymous
2024-09-10T12:10:39+00:00

I have developed some forms in Word. Documents are locked so that users can only fill in the fields in the form. I have code in the Save event for the document that throws a message to the user that they must use the "Save Form" button in the form - this button vaildates that the users have filled in the form correctly then saves the completed document to their downloads directory with a specific file name based on the information entered.

However some users seem incapable of following what the are supposed to do and I need to lock down the functionality

What I would like to do is to put code into the File SaveAs macro that will prevent users from using File SaveAs unless they are specific user id's. However whatever I put into the File SaveAs macro makes no difference, it just comes up with the standard "SaveAs" dialogue.

Is it not possible to modify the behaviour of SaveAs in Word (we are using Microsoft Office 365).

Microsoft 365 and Office | Word | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Anonymous
    2024-09-13T06:54:51+00:00

    Charles,

    In order to limit the users who can use SaveAs I plan to capture and test the user's windows login (Environ("username")) and block users in code where they are not in a list of approved users. However my problem is that whatever I try if you select SaveAs from the File menu it does not call the VBA FileSaveAs code. If I can find how to make it call the FileSaveAs code I should be alright.

    Background is that I have created a Form in word using active X controls and have a "Save Form" button in the document when pressed the VBA code in the FileSave procedure validates that the user has completed the form correctly then saves the form to the users "Downloads" directory with a specific file name based on information entered. However some of our users go to extraordinary lengths to try and not do what they are supposed to e.g. using File SaveAs and I need to stop them.

    All I need to find out is how to make the VBA code in FileSaveAs fire if the user tries to use File Menu -> SaveAs in the document.

    Was this answer helpful?

    0 comments No comments
  2. Charles Kenyon 167.8K Reputation points Volunteer Moderator
    2024-09-12T16:37:26+00:00

    I know of no way to limit the SaveAs command to certain users.

    You can substitute your process for the saveAs, though.

    Please copy your code from the vbe and post it here rather than a screenshot.

    How to Ask Questions In this Forum (to get the best and quickest answers)

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-09-12T14:38:09+00:00

    "I'm afraid you may need to use VBA macro solution to modify the behavior of SaveAs in Word"

    I have been trying to use a VBA macro to modify the SaveAs option on the File Menu, however whatever I put in the macro it seems to be ignored. The code below does not display the message box, just the standard SaveAs dialogue when called from the File menu.

    Image

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2024-09-11T12:08:56+00:00

    Hello David Holder,

    Good day!!

    To my knowledge, in Microsoft Word, modifying the behavior of the "Save As" functionality can be challenging because it is a built-in feature of the application. I'm afraid you may need to use VBA macro solution to modify the behavior of SaveAs in Word.

    Since we mainly focus on general and built-in feature queries in Word application, I sincerely recommend you refer to this article: Office VBA support and feedback | Microsoft Docs to go to Stack Overflow by using the VBA tag, along with any other relevant tags as there are also many experienced engineers and experts in the forums there. They will focus on the specific situation and provide specific suggestions for you.

    In the meanwhile, I will also keep this thread open so that community members and Word MVPs can share suggestions and insights here.

    Thanks for your cooperation and understanding! Hope you have a nice day!

    Best regards,

    Tina

    Was this answer helpful?

    0 comments No comments