![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
I welcome your thoughts on how to encapsulate my "On Error" statement and label for my word 2016 module that maintains an excel workbook.
I’ve rendered my daughter’s construction business client and vendor names as spreadsheets in an excel 2016 workbook. And I've customized her various waiver, invoice, notary documents and roster maintenance with word 2016 forms. The only need to invoke the workbook is to initially load the session’s client and vendor rosters, insert a new member or update a member. I’ve created a module I named “modRoster” to address these needs. I do not want to lock up the workbook for the entire session because only rarely will there be a need for anything but the initial roster load. And that occurs in the initial form’s activation. Were it not for the opening, closing and error handling for the workbook, the encapsulation is straight forward. Code:
Function LoadRosters() as Boolean Code:
Function AddRosterRow(pSheetName as String, pRowContent as Variant) as Long Code:
Function UpdateRosterRow(pSheetName as String, pRowContent as Variant, pRowNumber as Long) as Boolean Of the options I’ve considered: (1) Encapsulate an additional two functions / subs: Code:
Function OpenRosterWorkbook(pPathName as string) as Variant Code:
Sub ReleaseRosterWorkbook(pRosterObject) Or (2) Create an umbrella function that invokes the other functions via a Select Case statement between the opening and close of the workbook. That simplifies where to locate the On Error but requires passing all three parameters to the umbrella function which smells bad to me. These are the options I’ve considered. And I’m open to an entirely different approach. |
Tags |
excel 2016, vba code, word 2016 |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Another Unique Question for managing a project plan in Excel | IamThatGuy | Excel | 5 | 02-09-2022 02:10 PM |
Excel 2016: A query from same workbook | ArviLaanemets | Excel | 0 | 01-29-2018 07:22 AM |
Macro Personal Workbook does not load in Excel 2016 | Intruder | Excel Programming | 0 | 01-21-2017 05:44 AM |
![]() |
codeghi | Project | 3 | 09-28-2016 11:32 AM |
Newbie VBA question re Excel 2016 | Highlander | Excel Programming | 3 | 01-22-2016 08:02 PM |