+ Reply to Thread
Results 1 to 8 of 8

Microsoft Visual Basic error message when trying to print Excel user form

  1. #1
    Registered User
    Join Date
    10-14-2014
    Location
    Rochester, NY
    MS-Off Ver
    2010
    Posts
    7

    Microsoft Visual Basic error message when trying to print Excel user form

    I have created an Excel user form that uses VBA code to push the form data into a hidden worksheet within the existing workbook when the user clicks a command button. Once the data is pushed to the worksheet a print dialog box pops up so the user can select a printer to print the form to. This has been working fine for most users, however I learned recently that some users at a particular location are receiving the following errors message when they click the command button:

    Run-time error '1004':
    Method 'Worksheets' of object '_Global' failed

    I have been unable to troubleshoot this issue.

    Below is the code that I am using:
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 07-13-2015 at 03:46 PM. Reason: Added Code Tags

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Microsoft Visual Basic error message when trying to print Excel user form

    Generally can't print a hidden sheet... unhide, print, and re-hide?
    If that's not the issue then the sheet name may be incorrect. I can't find you actual print code so I can't guess any other reason.
    Additionally please use code tags when posting code. Highlight what is code and hit the # icon.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Microsoft Visual Basic error message when trying to print Excel user form

    Where do you get the error?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    10-14-2014
    Location
    Rochester, NY
    MS-Off Ver
    2010
    Posts
    7

    Re: Microsoft Visual Basic error message when trying to print Excel user form

    They are getting the error when they click command button cmdadd.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Microsoft Visual Basic error message when trying to print Excel user form

    Which line of code is the error ocurring on?

  6. #6
    Registered User
    Join Date
    10-14-2014
    Location
    Rochester, NY
    MS-Off Ver
    2010
    Posts
    7

    Re: Microsoft Visual Basic error message when trying to print Excel user form

    I am unable to answer that. The users who are experiencing this issue are not at my location and on my computer it works just fine.

    I'm thinking it has something to do with other settings on their computer and not the VBA code itself. I know that they are running Excel 2003 but I have other users on Excel 2003 who can print the forms without any issues.

  7. #7
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Microsoft Visual Basic error message when trying to print Excel user form

    Ah, any chance they have renamed a sheet?

  8. #8
    Registered User
    Join Date
    10-14-2014
    Location
    Rochester, NY
    MS-Off Ver
    2010
    Posts
    7

    Re: Microsoft Visual Basic error message when trying to print Excel user form

    No, that is not possible. The worksheets are hidden using the "very hidden" option and I doubt that anyone knows anything about using VBA. Plus, the file is shared by all employees so if a worksheet had been renamed the form wouldn't work for anyone.

+ 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. Replies: 1
    Last Post: 07-23-2013, 04:03 AM
  2. Microsoft Visual Basic File Not found error
    By mecva6 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2012, 01:01 PM
  3. [SOLVED] Microsoft Visual Basic Compile Error: Expected End Sub
    By shexe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-23-2012, 03:45 PM
  4. [SOLVED] Microsoft Visual Basic: Compile error: Sum or Function not defined
    By Dmitry in forum Excel General
    Replies: 12
    Last Post: 04-03-2006, 02:35 AM
  5. [SOLVED] Microsoft Visual Basic: Compile error: Sum or Function not defined
    By Dmitry in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 04-03-2006, 02:35 AM
  6. [SOLVED] Microsoft Visual Basic: Compile error: Sum or Function not defined
    By Dmitry in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 04-03-2006, 02:35 AM
  7. [SOLVED] Microsoft Visual Basic File not found (error 53)
    By michaelj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2005, 08:05 PM
  8. [SOLVED] Loading a linked spreadsheet, Microsoft Visual Basic, error while.
    By Wacher in forum Excel General
    Replies: 0
    Last Post: 04-18-2005, 11:06 AM

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