+ Reply to Thread
Results 1 to 31 of 31

Ignoring 1 of two modules

  1. #1
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Ignoring 1 of two modules

    Hi all,

    I am still perservering with my Purchase order project.


    I have managed to get it almost done with lots of help from here the last issue I have is this:

    The module I want transferred is working the assigning of the macro within that module to the button is working, however, when it gets to the FillSalesSheet section it opens the said workbook but then jumps to the module and the FillSalesSheet in that.

    Module 1 which I would like ignored on the newly formed workbooks looks like this:
    Please Login or Register  to view this content.
    Module 2 looks like:
    Please Login or Register  to view this content.
    It opens the Purchase order 26.01.10 (version 1) then tries to run the FillSalesSheet form there.

    If I run the FillSalesSheetNew in Module 2 on its own it say Subscript out of range.

    Can anyone help.

    I have attached the original workbook.

    Thank you in advance
    Attached Files Attached Files
    Last edited by Libster78; 01-31-2010 at 09:07 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    hi Libster78
    Is deleting module1 and option?
    If so
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Hi Pike,

    Not really as it is needed for the original spreadsheet(purchase Order 26-01-10....).

    What is happenin is as NewPrint macro is running it is opening the Purchase order 26-01-10 and then carrying on the macro from module 1 of that.

    Does that make any sense?

    Libby

  4. #4
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Basically what I ultimately want to do is to do a purchase order, print it and the contiuation sheet if there is one, fill the sumary sheet and save a copy of actual purchase order. This all works.

    From there I may need to access the save PO's to amend them hence why saved a copy. What I am looking to do is be able to amend this, print it with contiuation sheet if there is one and fill in the summary sheet on the original purchase order spreadsheet.

    That is what I want to achieve.

    There maybe a better way than what I have done.

    libby

  5. #5
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    wont this bit need to be in the workbook module?

    Please Login or Register  to view this content.
    or you could append the code in module 1 instead of importing module 2?

  6. #6
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    How does that work?

    I am all very new to this Pike and only understand little bits. Probably why this is so hard for me.

    When you say append how will that work? Th assigning of the macro is only in module 2 as this is to relate to the new workbooks formed each time only.

    So the new workbook is formed, module 2 transferred and the macro within module 2 NewPrint assigned to the print button on sheet one, saved as whatever the user wishes and closed.

    Then at a later date the user may go back into this spreadsheet to amend a cost they got wrong or something, then I want this to be saved separately but the details to go on to original sheet which will be saved on each users computer, unfortunately I will not know where.

    Have I lost you? I'm a bit confused myself now.

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    Ok firstly
    Please Login or Register  to view this content.
    can you zip the file then I can have a closer look

  8. #8
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Ok so is there a way I can do this?

  9. #9
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    Hey Libster78

    can you zip the file then I can have a closer look at the workbook

    the super fast wireless broadband ossie style is c##p and has limits

  10. #10
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Hi ya,

    Sorry for delay. Busy busy at work.

    I've attached the file as a zipped file.

    All I need to do is :
    the sheets which are copied (purchase Order and Continuation sheet to be opened at a later date amended and the same details filled into the summary sheet which is on the the original sheet.

    This will be used by several users in several locations so the Purchase order file could be saved in several different pathways.

    Thanks so much for your help.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Hi there again.

    Slight change of plan.

    The document will be saved in a specific location of:
    G:\Eworking\Comms\TPW\Administration\Consultants PO's\Glasgow & Birmingham\Purchase order 26-01-10(version 1).xls

    I'm hoping this makes a difference!

    Thank you
    Libby

  12. #12
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    Hi Libster78

    In module two replace

    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.

    in module one change
    Please Login or Register  to view this content.
    you will need the enabled the reference "Microsoft Visual Basic for Applications Extensibility 5.3 Library"
    Last edited by pike; 01-30-2010 at 12:50 AM.

  13. #13
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    thinking about it change
    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.
    and in module one
    change there to procedures to
    Please Login or Register  to view this content.

    But this all seems a little over the top What are we doing here?????
    Last edited by pike; 01-30-2010 at 05:34 AM.

  14. #14
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Hi there,

    This seems to work but for some reason it is still erroring at:
    Please Login or Register  to view this content.
    In the Transfer_Module(myfileName)
    Please Login or Register  to view this content.
    Is it something I've done?
    Thanks you so much for all your help so far.

    I just need module 2 to transfer to the copy and saved module and I'm there.

    Thanks again
    Libby

  15. #15
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    Hi Libster78

    I can forsee that the module2 wont do much in the new workbook

    Before we go that far, what are we trying to do???
    Create a new workbook?
    add a module?

  16. #16
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    In a way yes. The way it works so far is you fill the details you need onto the purchae order sheet and if necessary the continuation sheet.
    On clicking print it will print purchase order then ask re continuation sheet. If no continuation sheet it then transfers the data request to the summary shh
    et. Once this is all doneit copies purchae order and cont sheet to a new workbook an asks what you want to save it as and the new book closes. Then the purchase order and cont sheet are cleared of certain contents to make it ready for a new one to be filled in.

    What I need to do is to go into the created workbook and at anytime amend this and ensure the summary sheet on original sheet is filled in.

    This all works but only if I manually add the module with code for newly created workbooks to those workbooks when I reopen them.

    If the module transferred automatically it would work a treat.

    Am only dong it in excel because my company will not give the department that wants this the access to Microsoft access ( where it would have been a lot simpler.

    I hope this clarifies what I am trying to achieve. I am so close with all the help from you and a few others on here.

    I'm hoping it is possible

    thanks again for all your help so far.
    Libby

  17. #17
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    Hey Libster78
    If it was me I'd have a hidden button thats hidden in your main workbook
    But is visible in your new workbook
    try the attached zip

    also if we use the worksheet module, that you copy ,we really do have to import export modules as the code in the worksheet module will be copied.
    Attached Files Attached Files

  18. #18
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Hi Pike,

    You've been great. I did repeat the error post only to specify the error as I thought perhaps someone might have helped if you were offline.

    I will delete the other post.

    I think this works great however as I am currently try to run it on 2007 itis saying I cannot save to macro free workbooks. I've been to the trust centre and change the settings but still doesn't work.

    I'm sure it will work fine in the office on the 2003 version though which is what it needs to work on so thank you very much.

    I appreciate all your help on this.

    Thanks again
    Libby

  19. #19
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    Hi Libster78
    It will work in 2003, but for 2007 you will need to change the extension to xlsm
    but this will cause a problem in 2003
    we can add code to change the extension depending on the environment?

  20. #20
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Hi there,

    All works fine at work on 2003 thank you.

    It would be good to have the code so it can work on 2007 and 2003 as I may be able to use this again for something else.

    Also, one last thing, is there any way we can get Command Button 1 to say Print and Command Button 2 to say Amend? Not a worry if we can't. the most important stuff is working.

    Thank you agawin for all your help.

    Libby

  21. #21
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    Hi Libster78
    yep if you are in design mode > right click on the button > properties . caption to "print"

    it still may need refining just let me know..

  22. #22
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Thanks Thats great. I think it might be better if both buttons are visible all the time and labelled but I think I've worked that out.

    Now I just need it to find the document path to open the purchase order sheet on amending but thats simply getting path right.

    I'll let you know if there's any tweeking but otherwise you have been brilliant.

    Thanks again.

    Libby

  23. #23
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Ignoring 1 of two modules

    Hi Libster78
    the code that sets the button visiblity is in the workbook module
    it sets the visibility on opening

  24. #24
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    All working fine however, when it prints it is showing the buttons on the print? Very strange. How can I get that not to do that?

    This should be it then!

    Thanks

    Libby

  25. #25
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Also for some reason the date from the purchase order sheet is being transferred to the summary and changing. Very strange. It says 01/02/2010 on purchase order but is moving to the summary as 02/01/2010. I thought it may have been in the american format but it isn't it is saying 2nd January.

    Any clues?
    Libby

  26. #26
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Ignoring 1 of two modules

    How are you transferring? You probably need to use CDate to ensure it remains as per your local settings.
    Everyone who confuses correlation and causation ends up dead.

  27. #27
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Just using the offset.

    Code is:
    Please Login or Register  to view this content.
    Where K1 is the date. K1 has the function TODAY() which says 01/02/2010. In theory this should just link it shouldn't it? It has always worked before until today.

    Really strange.

  28. #28
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Ignoring 1 of two modules

    Don't use the Text property - use the Value:
    Please Login or Register  to view this content.

  29. #29
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    Thank you. Seems strange that text worked before but as long as it is working.

    Thank you.

    I don't suppose you can tell me why command buttons would print?

  30. #30
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,980

    Re: Ignoring 1 of two modules

    If it's from the Control Toolbox, you need to enter Design Mode (the blue triangle icon on the Control Toolbox toolbar), select the button, right-click and choose Properties, then set the PrintObject property to False.

  31. #31
    Forum Contributor
    Join Date
    01-21-2010
    Location
    Glasgow
    MS-Off Ver
    Excel 2003 and 2007
    Posts
    105

    Re: Ignoring 1 of two modules

    fab thanks.

    I knew it must be something simple but I am se new top this and learning as I go.

    Thansks for your help with the copying of cells to a closed workbook too.

    Fantastic. Thanks again.

+ 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