+ Reply to Thread
Results 1 to 7 of 7

VBA code not working when distributed

  1. #1
    Registered User
    Join Date
    01-27-2014
    Location
    Orlando
    MS-Off Ver
    Excel 2016
    Posts
    49

    VBA code not working when distributed

    I have a workbook containing a few wsheets, and once I supply the code to the (This Workbook), the code works fine. As an FYI, the code's objective is to lock the scroll areas on each sheet. When I email this file to another user, the code isn't working. This is mainly due to their security settings, which are set to not allow macros. Is there a workaround to this? My wants or needs are this, when the user opens the file, the scrolling areas I set in VB will work seamlessly.

    I was thinking along the lines of creating a macro to "freeze or lock" the entire workbook, and the user will have to follow instructions to enable macro security properly. What this really boils down to is that I want to maintain the aesthetics of the design.


    While I am in here, and being a separate issue, when I look in the editor, it seems that vba projects keep adding on top of another, and I cannot delete these in the editor. I have to delete these files in the directories and start over again. When I start saving a file, somehow it adds yet another vb project (same file name). Weird. Any ideas?

    Thanks!


    Private Sub Workbook_Open()
    Worksheets("Main").ScrollArea = "A1:AL115"
    Worksheets("1st Qtr").ScrollArea = "A1:Ar130"
    Worksheets("2nd Qtr").ScrollArea = "A1:Ar130"
    Worksheets("3rd Qtr").ScrollArea = "A1:Ar130"
    Worksheets("4th Qtr").ScrollArea = "A1:Ar130"
    Worksheets("REP HOURS").ScrollArea = "A1:Ar130"
    Worksheets("UNION ARTICLES").ScrollArea = "A1:M40"
    Worksheets("UNION REPS").ScrollArea = "A1:S80"
    Worksheets("L1458 Stewards").ScrollArea = "A1:Q60"
    End Sub

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: VBA code not working when distributed

    Hi,

    One way would be to get your users to make the folder in which they hold your files a Trusted Location. The Macro security is there for a reason.

    Not sure what you're getting at with your second question but since it is a separate issue I suggest you raise a thread in its own right and give a little more clarification.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    01-27-2014
    Location
    Orlando
    MS-Off Ver
    Excel 2016
    Posts
    49

    Re: VBA code not working when distributed

    Thanks Richard and Merry Christmas to you sir,

    Your input is appreciated, however, being that I work in the Federal Government, there will be hundreds of people that will be receiving this file over time. Therefore, your approach would be a little cumbersome "respectfully". If there is no way around this, then all I can do is to provide written instruction on the main worksheet. My second concern would be that my password protection stay in tact. Thanks again!

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: VBA code not working when distributed

    Rather than restrict the scroll area, which requires code, could you not hide the rows and columns to the right and below the area the user is allowed to see?

    Edit: I guess this does not actually stop the user from scrolling the cells out of view, so maybe not a good work around.

    Ghost VBProjects in the project window of the IDE can be caused by other addins.
    Last edited by Andy Pope; 12-11-2014 at 11:34 AM.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    01-27-2014
    Location
    Orlando
    MS-Off Ver
    Excel 2016
    Posts
    49

    Re: VBA code not working when distributed

    Thanks Andy, yes, by hiding rows or columns, this will still not solve, however, A+ for effort! As for Ghost VB, sounds scary, lol. I am unsure what all that entails, but if there were a method out there that would solve the dilemma, I am all for it! Thanks again sir.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: VBA code not working when distributed

    Actually if you also remove the scrollbars then it does work. See attached.

    With the vbprojects you would need to check what addins (com addins) you have and remove them. Then add them back one at a time testing to see if the project duplication occurs.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-27-2014
    Location
    Orlando
    MS-Off Ver
    Excel 2016
    Posts
    49

    Re: VBA code not working when distributed

    Thanks Andy, I like folks who think outside the box! Enjoy your holidays sir

+ 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. [SOLVED] Vba code working in workbook module but not working from personal.xlb
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-19-2014, 05:47 AM
  2. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  3. [SOLVED] VBA Code (colums to row, autofill) stop working in row 294 when new cable code appear
    By sknifseht in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2012, 05:27 AM
  4. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM
  5. Condensing Repetitive Code Distributed to Multiple Sheets
    By inwalkedbud in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-01-2007, 01:46 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