+ Reply to Thread
Results 1 to 11 of 11

Generate Quote Report based on User Form?

Hybrid View

sigma1113 Generate Quote Report based... 12-28-2022, 09:20 PM
BadlySpelledBuoy Re: Generate Quote Report... 12-29-2022, 06:19 AM
sigma1113 Re: Generate Quote Report... 12-29-2022, 09:26 AM
torachan Re: Generate Quote Report... 12-29-2022, 02:28 PM
sigma1113 Re: Generate Quote Report... 01-03-2023, 10:32 AM
sigma1113 Re: Generate Quote Report... 01-05-2023, 01:35 PM
torachan Re: Generate Quote Report... 01-05-2023, 03:04 PM
sigma1113 Re: Generate Quote Report... 01-05-2023, 06:00 PM
torachan Re: Generate Quote Report... 01-06-2023, 09:50 AM
sigma1113 Re: Generate Quote Report... 01-06-2023, 12:18 PM
torachan Re: Generate Quote Report... 01-06-2023, 01:54 PM
  1. #1
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Generate Quote Report based on User Form?

    I have been developing a quoting workbook in which the user is prompted to fill out a user form with all relevant data. The user form then populates a work sheet where further calculations are performed to determine the total cost of a lot of parts based on different labor rates and the cost per part based on lot size.

    I would like the button on the user form that populates the worksheet to also generate a quote (.PDF) that is displayed and saved to a folder. Report to include certain user form entry fields and some of the calculated data that happens in the background on the worksheet. Ultimately I would like this quote to be stylized, not in basic Excel formatting. Every time the user form is accessed it should only report on the data entered and the calculated values based off of those entries.

    I have little experience with VBA, I have been able to piece together the user form and populating the worksheet (works as intended), I'm just not sure how to get the next step of generating the report.

    Any help would be appreciated.

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,951

    Re: Generate Quote Report based on User Form?

    Quote Originally Posted by sigma1113 View Post
    Ultimately I would like this quote to be stylized, not in basic Excel formatting.
    Not quite sure what you mean by this bit.

    Quote Originally Posted by sigma1113 View Post
    Every time the user form is accessed it should only report on the data entered and the calculated values based off of those entries.
    Nor this bit.

    Perhaps some further information on both points would be helpful.

    Also, it may be useful if you could put together something like what you want contents of the PDF to look like. I presume it would be the "Quote Sheet" just turned into a PDF, but as that's blank at the moment it gives us little info to really help you here.

    BSB

  3. #3
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Re: Generate Quote Report based on User Form?

    I suppose what I meant by a stylized quote was that I wanted the formatting to look neat and professional... not just a bunch of cells printed on a page. I wasn't sure if a report, or in this case a quote, template was created in a similar way to a user form or if it is just a formatted work sheet that gets populated.

    To your second point, when the user form is filled out it enters all of that information into a single row on the MachiningQuotes Tab, upon entry into that row the report template should be filed in with only the relevant input and calculated data from the newest row.

    To keep things simple for now, say I just wanted to report on the Part Number, Lot Size, and Cost Each Columns. I'm looking for the method on how to pull the data from the most recent row of entries for those columns, populate cells on the quote sheet with those data points and then save as pdf and save to a folder. After which the template should be cleared of all data ready for the next user form entry. Once I have the process down I should be able to modify it to the data columns I really need in the quote and will be able to format the template.

    Hope this explanation helps a bit.

  4. #4
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Generate Quote Report based on User Form?

    See if the attached approach is any use as a guide - you do not need all the PDF formatting I have included (it there so that you can alter - save you looking up the detail)
    I have used 'structured tables' throughout (they give better (simpler) data handling methods) also removed your hard coded .AddItems - (better practice not to hard code variables - simply modify the relevant tables)
    There is no formula on the sheets - this is taken care of with the code - if your app grows large the last thing you want is a sheet that calculates as every item is entered this will slow down a big app.
    p.s. note the file is 1/10 th. size using 'structured table' instead of a range formatted with borders and filled with formula.
    Attached Files Attached Files
    Last edited by torachan; 12-29-2022 at 02:31 PM.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  5. #5
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Re: Generate Quote Report based on User Form?

    Thank you for this.

    I have gone through your setup and understand most of it. The data entry form and Machining Quoting sheet work as I want but I am still having some issues with the quote sheet. I wanted to change around the quote sheet a little by adding more tables but I'm not sure if I coded them correctly to get them to fill in.

    2 changes I would like to figure out how to make:

    Have the functionality of the Save and Print button built into the OK button so it will fill the machining quotes table as well as save and print.

    I want to save to a local folder on my computer rather than an external USB drive.

    Thanks.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Re: Generate Quote Report based on User Form?

    One additional note on this issue. The quotation sheet is not being filled. When the OK button is pressed to log the data into the Machining Quotes worksheet the form is cleared and then the Save Print button has nothing fill into the tables. Function of generating the PDF works but all of the fields are blank.

  7. #7
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Generate Quote Report based on User Form?

    1) I have altered the data retrieve for the form to take the data from the last row of Table1 instead of from an array
    2) everything is saved to the sheet/transferred to the PDF and saved on the USB (you will need to establish a folder on your computer and determine the path, then alter in the save routine)
    did you manually clear the first row of data, there was a full stop (point) in the first cell to fool the array (ary1) loading (I have put a check in to bypass this error if there is no data in Table1, no need now for 'full stop'
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Re: Generate Quote Report based on User Form?

    Ok so I am almost there... I just don't understand how to change the file path to a local drive.

    I understand that the following bit of code is scanning the drives and looking for a USB drive. Once found, it assigns the drive letter to MyDrive2. MyDrive2 is then used in the second bit of code to assign the file location.

    Since I will save locally, for instance to "C:\Users\XXXXX\Desktop\Machining Quotes", I do not need to scan for a USB drive (perhaps just scan to make sure that folder is present?) how do I change the value of MyDrive2 to the file path of the folder I am saving to? or is there a different method for this?

    Thank you for all of your help thus far.

    Set FSO = CreateObject("Scripting.FileSystemObject")
    For Each Drv In FSO.Drives
    With Drv
    If .IsReady And .DriveType = 1 Then
    decision = MsgBox("Detected USB Removable storage device in drive " & .DriveLetter & vbCrLf & "Do you wish to continue ?", vbQuestion + vbYesNo, "Save ?")
    If decision = vbNo Then Exit Sub
    MyDrive2 = .DriveLetter
    GoTo SaveRoutine
    End If
    End With
    Next Drv
    MsgBox "No USB Removable storage devices found", vbInformation
    Exit Sub
    Sheet4.ExportAsFixedFormat Type:=xlTypePDF, Filename:=MyDrive2 & ":\" & tbl1.Range(a, 2) & " " & Format(Now(), "MM-DD-YYYY") & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True

  9. #9
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Generate Quote Report based on User Form?

    if you put a new folder on your desktop (named 'MachiningQuotes') and use the dialog box in the attached code it will make it more versatile for you.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    10-14-2009
    Location
    NJ
    MS-Off Ver
    Excel 365
    Posts
    16

    Re: Generate Quote Report based on User Form?

    Thank You, the save functionality now works as intended.

    The last thing I am trying to do is add hyperlinks to the file paths.

    On the user form I created a DrawingFilePathCommandButton for the user to select a file from the computer and then it inserts that file path into the DrawingFilePathTextBox.Value, this portion of the code works properly.

    Private Sub DrawingFilePathCommandButton_Click()
        Dim s As String
        s = Application.GetOpenFilename
        DrawingFilePathTextBox.Value = s
    End Sub
    Under the OKButton_Click Sub, I want to store DrawingFilePathTextBox.Value (the drawing filepath from above) as a hyperlink in .Range(31).Value so when it is stored into the MaciningQuotes Worksheet it displays and behaves as a hyperlink. I tried the following bit of code but I get a Run Time Error 5.

    ActiveSheet.Hyperlinks.Add Anchor:=.Range(31).Value, Address:=DrawingFilePathTextBox.Value, TextToDisplay:=PartNumberTextBox.Value
    Finally that Hyperlink should be present on the saved PDF as well.

    Thanks.
    Attached Files Attached Files

  11. #11
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: Generate Quote Report based on User Form?

    hyperlink add code annotated ('******hyperlink*****) - do not declare variables just within a sub - declare them at the 'head' immediately after 'Option Explicit' if they are declared in the sub they are only available within the sub - if you need them across several subs they need declaring at the head of the userform code (note in the case of 's' picking up as the hyperlink name variable)- also declaring Option Explicit aids you when running debug to pick up conflicts
    Attached Files Attached Files

+ 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. To generate report and show chart in VBA form
    By dalviaks1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2021, 11:15 AM
  2. How to auto generate a number in user form
    By katieshields in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-20-2014, 08:13 AM
  3. how to generate automatic report using form/macro
    By rajeev.raj in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-07-2012, 02:20 PM
  4. Generate a new worksheet each time a user form is filled out
    By brandoom989 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-18-2012, 03:40 PM
  5. Generate Summary Report in a tabular form from the Input Sheet
    By excelhelp18 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-30-2012, 12:52 PM
  6. Change form-based report to table-based report
    By drewship in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-27-2009, 08:55 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