+ Reply to Thread
Results 1 to 8 of 8

File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

  1. #1
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

    Excel userform (uf4_works) with 24 toggle buttons (tglb_xxx_xxxx where xxx_xxxx is variable based on selection) allowing user to select any number of reports for creation (via Word mail merge) or viewing (previously created)
    Here is code from one of the 24 button presses.

    Please Login or Register  to view this content.
    Here is the 'button_check' routine
    Please Login or Register  to view this content.
    Once the user has selected the report(s) they wish to create they can proceed with the creation of the mail merge document creation process by pressing a button on the userform ([PROCEED]) toi launch the code which processes the selections and prepares them for the merge process. Here is that code (greatly editted to exclude the repetitiveness of 24 reports, I have shown only one of those 24)

    Please Login or Register  to view this content.
    ... to reduce the length of the post, it's continued in the next reply.

  2. #2
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

    Continued from first post ...

    Here is the code that that launches the mail merge routine ...
    Please Login or Register  to view this content.
    So, that's the lead in to the problem.

    This for the most part works wonderfully. The selection of the reports, the setup for their creation, and the mail merge process are working well. When the mail merge is complete, the report is saved, and Word closes for that instance before being reopened upon the creation of the next report. And so that routine continues as long as reports are being created from the cue. These newly created files are saved, and following saving, at any point thereafter, thehose mail merge documents can be opened and edited, and then saved wihoout any error. I had been d=getting file permission errors when I corrected my mistake of not quiting objWord and setting it to nothing after the completion of each report creation. Back on the userform though the button state for the selected and recently created report is TRUE with formatting indicating file creation in progress. In an effort to reset the button to a FALSE state and change it's formatting to reflect on the report having been successfully created and saved, i included the line in orange.

    This line effectively resets the button, but, after doing so, that file becomes locked again with file permission conflicts whenever that file is edited thereafter and attempted to be saved. So, if it don't do a 'button_check' to reset the button to the preferred state, the created file is not read only (locked) and can be edited and easily saved. With button check executed, those same files become read only (locked) and I can't save any edits regardless how the file was accessed.

    This is one of the last remaining "significant" hurdles remaining in a 4 year project. I would be greatly indebted to anyone that can help solve the problem. I figure since it took me more than an hour to post this, the solution will likely be super simple! But however simple it is, it's not that simple for me to figure out. I need your help!

  3. #3
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

    Even with button_check out of the picture I get errors.
    I don't know whats going on. Sometimes I get errors, sometimes I don't. I have a hard to recreating the scenario, I don't know at what point the file is being "locked". I may have to take this to a paid solution.

  4. #4
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

    Further testing.
    Created all reports (mail merge docs). No Word instances open or visible.
    Closed up Excel.
    None of the 8 reports the Excel app created can be saved after opening, even if there were no changes.
    "Word cannot complete the save due to a file permission error."

  5. #5
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

    And, I have just realized that this problem isn't just exclusive to the reports created by this Excel VBA driven mail merge.
    Other totally unassociated .docx files on that drive cannot be saved after opening due to file permission errors.

  6. #6
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

    Quote Originally Posted by Jenn68 View Post
    Other totally unassociated .docx files on that drive cannot be saved after opening due to file permission errors.
    In that case, your problems most likely have nothing to do with Word or Excel, but with your network configuration. That said, you might try repairing the Office installation (via Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change > Repair).
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  7. #7
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

    Thanks Paul, but would that be a solution for the same problem two totally different computers? Its only for that reason I suspect the files. I don't experience the issue in post #5 after I restart my computer, it appears (and it's difficult to define because I have yet to pinpoint the circumstances as to when I have this problem) that these files don't exhibit the problem (although the docx. created by mail merge through the Excel VBA are consistently locked.)

    For example, those files I tried to edit and save from my work computer (onto a thuimbdrive that I work from between computers) yesterday that gave me problems. I have no problems with while working today at home with a fresh session.
    Last edited by Jenn68; 06-15-2019 at 08:24 AM.

  8. #8
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: File Permission Errors With VBA Assisted Mail Merge / Excel VBA Userform Access

    The fact that multiple computers are affected, plus documents other than reports created by your mail merge are affected certainly points in the direction of a network configuration issue (e.g. with user profiles and/or a network fault). Your ability to edit the document on a thumb drive reinforces that view.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Create mail merge using excel VBA userform
    By emina002 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-06-2016, 09:24 AM
  2. Replies: 0
    Last Post: 01-05-2015, 07:35 AM
  3. Replies: 3
    Last Post: 05-08-2014, 07:11 PM
  4. Replies: 2
    Last Post: 01-22-2013, 11:37 AM
  5. [SOLVED] RUN a mail merge (Word file) from a USERFORM in EXCEL
    By alopecito in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 09-18-2012, 09:41 PM
  6. Macro errors before save of mail merge document
    By pjbassdc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-06-2011, 02:35 PM
  7. [SOLVED] Re: There should be a mail merge feature between excel and access.
    By Vira-SJH in forum Excel General
    Replies: 0
    Last Post: 01-03-2006, 02:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1