Posts by Greg

    hello,


    I have the below code that works for some reason. it deletes columns in RngHeaders by treating Rng2Del (another range) as an array and matching against RngHeaders.


    But I'm getting a Type mismatch when passing it as below:


    i understand i can declare Rng2Del as an array and prepopulate in the calling procedure but why the original code does not require any of these manipulations?


    Thanks,
    Greg

    Re: Hide Column based on Column Heading name from another Excel Sheet



    This is just a brilliant piece of code

    Re: USD $40.00 Creating a memo in Word from Excel


    Hi Andrew,


    It seems logical to clean up all the bookmarks at the end so i added this code at the bottom of main procedure replacing:

    Code
    Memo.Save

    :



    It stumbles though after deleting about half of bookmarks. do you have an idea why? (not urgent)


    Thanks again,
    Greg

    Re: USD $40.00 Creating a memo in Word from Excel


    Hi Andrew,


    Thank you for the detailed response. I should have been more precise in my requirements as the users do need more freedom with tables especially table_selection. This is driven by the fact that different products will require various set of headings and number of columns. And the only formatting required for tables are the font (Times New Roman) and gray cell background for headings. This is fine though as i have two ways of doing tables now. :)


    I have not finished my changes and merging two sets together, but I think i have a good handle on it. I consider the work successfully completed and just sent you a payment. I greatly appreciate your very well-thought code, professional approach and timely responses.


    Thank you and Best Regards,
    Greg

    Re: USD $40.00 Creating a memo in Word from Excel


    Hi Andrew,


    That is a lot of coding for tables, so i have a question: Can the following be used to paste a table into word via simple bookmark:


    Code
    Memo.Bookmarks(BmarkName).Select
     Memo.ActiveWindow.Selection.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False, RTF:=True


    The table range in excel can just be controlled using Dynamic Named range as in here
    http://www.ozgrid.com/Excel/DynamicRanges.htm


    It seemed to work for me, but there might be potential pitfalls that I'm not aware of.


    Thanks
    Greg

    Re: USD $40.00 Creating a memo in Word from Excel


    Hi Andrew,


    i'm looking at it now, adding fields/bookmarks and changing formulas a bit. I'm also expanding the memo with real data. I think it would be fair and useful for you to see. Is there an email i could send it when completed? i just don't want to publish it here due to sensitivity of data.


    In the interim, can you please not do more changes (if you have not yet of course) except tables?

    I'm aiming to send it to you by Sunday Morning London time.


    Thanks
    Greg

    Re: USD $40.00 Creating a memo in Word from Excel


    Hi Andrew,


    looks good. I greatly appreciate the generic solution and all the hard work involved to make it generic.
    Unfortunately, I haven't had time to test it thoroughly as I wanted to provide some feedback.


    Quote from AndrewMB;527531


    The layout of the Fields sheet should not be changed, but the layout of the Inputs sheet can be changed as much as you like as long as the formulas are adjusted appropriately.


    Is that still safe to create new fields at the bottom? For instance, as I forgot to add ‘Main Scope’ and ‘Additional Scope’ inputs; can I add two fields Scope1 & Scope2 at the bottom, look them up from Inputs, and create two new bookmarks in memo.docx (they should be called appropriately)? will it will flow through?

    Quote from AndrewMB;527531


    I have assumed that the memo and questionnaire will be in the same directory, rather than in a specified directory - this makes for a portable solution, but let me know if you don't want this.


    Great idea! the path field is redundant then



    - The date will be today’s date (there is default field for that in Word). The same is true for ref: it will be just file name (no need to use code, I will just insert a field from Quick Parts in Word.
    - Can we fill in the measurement date after the period ended? Also, if I ever want to change a date format from say mm/dd/yy to dd-mmm-yyyy, will that format be carried over to Word?
    - The word “conclusions” and “more text” at the end should not have any yellow, it was by accident. I was stripping the memo down in a hurry trying at the same time to remove/substitute any company/client sensitive info (here comes Red Fox) as I was about to post in the public domain. My apologies for that.
    - Very good handling of the plurals. Thinking about another aspect of it: can we add a check for the words ‘products’ and ‘positions’ in case the client has only one product which is sometimes possible?
    It is a good idea to have a separate field (and input) for date when the products were purchased. Again, given that the code is generic do you think I could do it on my own?
    - Memo header and footer had our company name, etc., so I removed it. It will be static in the memo.docx.
    - “more text” should not be yellow and will be static data.


    I’m going to try to test it with real data (no more vacuums) by Sunday morning. That would give much better idea of any gaps.


    Thanks again,
    Greg

    Re: USD $40 Creating a memo in Word from Excel


    Hi Andrew,


    Thank you for responding. Your understanding is generally correct. I added a few comments below.


    Quote from AndrewMB;527263


    Let me check my understanding:
    - the data is to be taken from column C of the Inputs sheet and inserted into the fields on the memo where the text highlighted in yellow corresponds to the value in column B of the inputs sheet.


    That is correct

    Quote from AndrewMB;527263


    - the tables on the Tables sheet are to be placed into the corresponding tables in the memo.


    the tables should be placed into those spots rather than corresponding tables as the new tables my have different layout.


    Quote from AndrewMB;527263


    - you would like a 'general' solution which does not rely on the layout of the memo or the names of the fields.


    correct. additionally, it would not rely on the layout of the input spreadsheet too much


    Quote from AndrewMB;527263


    You have the following types of data handling required:
    - transfer data as is
    - set one of a group of checkboxes
    - insert text which can be derived from the inputs using a formula


    -checkboxes are already sitting in stripped (default) Word template. just the ability to check one of them based on the input.
    -there are also dropdown inputs (via validation) that would trigger different text values to insert


    Quote from AndrewMB;527263


    I'm not quite clear on the significance of "if left blank omit on the memo". What else might you do?


    might not be important, let's touch base on this later.


    Quote from AndrewMB;527263


    This suggests to me a solution which would involve:
    - a memo template where all the placeholders where data is required are indicated by bookmarks (probably easier to use than the yellow text there at present) - the name of the bookmark will correspond directly to the name in Column B.


    or custom fields? just a thought - I've never done any VBA with Word so bookmarks might be easier - i don't really know


    Quote from AndrewMB;527263

    - columns on the Input sheet which codify the type of processing required and the actual text to be inserted (calculated by formula) - similar in information content to what you show in columns D onwards, but more directly transferrable. In some cases some extra rows may also be desirable, e.g. when filling in checkboxes it may be simplest to calculate the value of each checkbox in a separate row.


    Column D onwards was more for your purposes. The excel file will go to a group of users who have an unpleasant habit of tempering with everything, so i'd rather have only columns B & C. However, as the word document is a given and excel file is what is being built, obviously there is more flexibility with Excel file. Let's create those if needed, but cannot deviate from memo's formatting, styles, check boxes, etc., even though it does not have the world best design.


    Thanks again.
    Greg

    Hello


    This task is to automate writing memorandums of work in Word (word memos) based on a questionnaire in Excel. Therefore, it is important that a developer taking on the task would be well versed in Word as well.


    I’m attaching both the questionnaire and a sample memo template. No registration is necessary to download these files from the below links – just chose slow (free) download – takes 1 sec


    Excel http://rapidshare.com/files/426235611/Questionnaire.xlsx


    Word http://rapidshare.com/files/426236066/memo.docx


    The user will be filling in the questionnaire, run the code and have a memo ready. The goal is to have it automated as much as possible.


    There are the following field types in the questionnaire:


    - Static data that just need to be transferred in the respective placeholder(s) in Word
    - Boolean or drop down that would call different data or check different checkboxes in Word
    - Ranges – two tables in Excel that may have various #rows/cols


    The code should be adaptable; that is a user can make own changes to it (e.g., ability to insert another table or section in word)


    Also, I would like an ability to use a different word template if needed.



    Value: USD $40 payable through paypal. Please let me know if you could do it and approx time frame.


    Thanks in advance,
    Greg

    hello,


    There is a computer Product ID found by right clicking on computer icon, and going into Properties.


    Is there a way to pull via VBA?


    Thanks
    Greg

    Re: Date in TextBox: Validation


    hi Norie,
    Thanks for your reply


    I'm trying to validate that


    1. the actual date is entered in TextBox_expiry
    2. the date entered in TextBox_expiry is Not smaller than date which is already in TextBox_today.


    I have two if statements for each if you look at my code.
    Greg

    Hi,


    I am trying to validate two things for one TextBox and they somehow contradict each other:



    Could someone help me streamline it a bit?
    Also, what other date formats I could use besides "dd mmm yy?"


    Thank you,
    Greg

    Re: Incremental progress bar?


    Exactly! I had it as Long. Thanks a great deal Tom!


    Now, do you know why if I replace the line


    Code
    Application.StatusBar = Format(PctDone, "#.##%") & " completed"


    with

    Code
    If If PctDone = Round(PctDone / 0.05, 0) * 0.05 Then _
    Application.StatusBar = Format(PctDone, "#.##%") & " completed"


    it is not working ?

    Re: Incremental progress bar?


    that's what i have

    Code
    For i = 0 To TextBox_cnt.Value - 1
                Start_cll.Offset(i, 0).Value = lcg.NextNumber
                PctDone = i / (TextBox_cnt.Value - 1)
                Application.StatusBar = Format(PctDone, "#.##%") & " completed"
    
    
    
    
            Next i


    Also, what about the increment?

    Hi all,


    I have a code that has a loop with up to 100,000 possible iterations. The max number of iterations, N, is variable and to be specified by the user via user form.


    That's why I like to show only incremental progress , say 5% competed , 10% completed ,... , so on. What is the best way to code it?


    Another question: I tried to show it via

    Code
    Application.StatusBar = Format(PctDone, "#.##%") & " completed"


    but for some reason it does not get updated while the code is running. Is that because the user form is visible? For now, I'm trying to add a label progress bar to the user form, but StatusBar would suffice.


    Thank you,
    Greg