+ Reply to Thread
Results 1 to 8 of 8

Update code for Print function on Form in Visual Basic

  1. #1
    Registered User
    Join Date
    09-15-2011
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    5

    Update code for Print function on Form in Visual Basic

    All,
    I have an excel workbook that contains several pages, and has a "main menu" in that allows you to hide/unhide tabs, and print individual tabs... The issue is once I change the tab name, button to hide/unhide no longer works and the button to print the tab no longer works. I have very limited knowledge on VB, and am figuring it out as I go... Below is the code... My guess is I can update the code to refer to "sheet1" as oppose to the actual tab name, but want to ensure I do it correctly. The code below is for the "print button" for the overview page, which is sheet19. I appreciate the help in advance.

    Please Login or Register  to view this content.
    Last edited by TheDude001; 09-15-2011 at 02:17 PM.

  2. #2
    Registered User
    Join Date
    09-15-2011
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Update code for Print function on Form in Visual Basic

    anyone????

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Update code for Print function on Form in Visual Basic

    We can't help without the full code. It looks like you specify a sheet called "overview". For good coding using sheets you shouldn't use the sheet name - see this for a start.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    09-15-2011
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Update code for Print function on Form in Visual Basic

    royUK,
    Thankyou for the info/link... That was my assumption. I am working on a workbook that has 60+ tab and over 1500 line of code just for the "main menu" form, hence why I didn't post all the code. All code refers to sheet tab names as opposed to sheet code names, which is the problem. Is there a relatively easy way to correct this ( I assume not), or should I just deal with the limitations in its current state? Thanks again for the assistance.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Update code for Print function on Form in Visual Basic

    Use Find & Replace within VB Editor to correct the use of Code Names.

    1500 lines of code for one form seems excessive, as does 60+ tabs

  6. #6
    Registered User
    Join Date
    09-15-2011
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Update code for Print function on Form in Visual Basic

    Needless to say, it is a complex model I use for work and yes, it is big. I am beginning to think too complexe for its use... Based on the orginal code posted above, would it be as simple as replacing "Overview" with the sheet code name? Or does the preceeding code need changed too. I appoligize for the ignorance... I am obviously over my head, but am learning slowly.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Update code for Print function on Form in Visual Basic

    Try replacing that reference to overview & any other sheet names. Use Debug frequently to check for errors caused by the replace

  8. #8
    Registered User
    Join Date
    09-15-2011
    Location
    North Carolina
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Update code for Print function on Form in Visual Basic

    Thanks, will give it a try.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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