Automatically create new Excel file from template using data from a selected row in a separate Excel file

I am fairly new to Macro and VBA in Excel. I am trying to reduce the amount of work involved in a task that is performed often in our office. Currently, the task involves using 2 separate Excel files. One file is a tracking sheet and the second is the document
that gets sent out to the client. The second document has all the same information that is inserted into the tracking sheet. What I would like to do is have the information that is in one row on the tracking sheet populate into a new excel file that is created
automatically from an existing template.
I have been able to make this partially work. What I have been able to achieve is have the cell that is selected in the tracking sheet (the description field) copy into the new file that is created from the template that is on our server.
Sub NewRFI()
' NewRFI Macro
    MsgBox Selection.Address(ReferenceStyle:=xlA1, _
                           RowAbsolute:=False, ColumnAbsolute:=False)
    Selection.Copy
    Workbooks.Add Template:= _
        "template file path goes here"
    Range("C14").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    Range("C14").Select
    Application.CutCopyMode = False
End Sub
What I need to do is get the rest of the information from that same row in the tracking sheet to copy to the new file as well. The other information includes the document number (one cell to the left of the selected cell), who it is from (one cell to the
right of the selected cell), and the date (two cells to the right of the selected cell). As stated, this information is all in the same row on the tracking sheet. Each piece of information needs to be copied to a certain cell in the new file and I do not want
the source formatting to be copied to the new file.
Ideally, I would like it to operate like so: select the first cell in the row (in this case would be the document number field). Then click a button to run the macro that will then copy the information from that row in the tracking sheet to specific cells
in the new file that is created from the template.
This process will save us from having to either manually copy and paste the information into the new file or re-type the same information that is already in the tracking sheet.
This is probably a simple thing to do but it would be great if anybody had some insight on this issue. Thanks in advance!

Try code like the following. You will have to change the target cells (D25, F1 and H4) to the ones you want, I just used some arbitrary cells as example.
Sub NewRFI()
Dim rngCell As Range
Set rngCell = ActiveCell
MsgBox Selection.Address(ReferenceStyle:=xlA1, _
RowAbsolute:=False, ColumnAbsolute:=False)
Workbooks.Add Template:="template file path goes here"
Range("C14").Value = rngCell.Value
' Change the target cells as needed
Range("D25").Value = rngCell.Offset(0, -1).Value
Range("F1").Value = rngCell.Offset(0, 1).Value
Range("H4").Value = rngCell.Offset(0, 2).Value
End Sub
Regards, Hans Vogelaar (http://www.eileenslounge.com)

Similar Messages

  • Email templates using data from iWork Numbers spreadsheet

    As a photographer, when I get a call from a client to book a shoot, my first step is to open my bookings spreadsheet in Apple's Numbers and input the client's info into pre-determined columns: name, phone number, job date, job scheduled arrival time, job address, job city, travel distance, details regarding the shoot, and then I have a list of columns that specify costs (cost for work, taxes, travel, etc--automatically calculated via functions in spreadsheet).
    Immediately after I insert this information into the bookings spreadsheet, I open another file (a text file)--a text template I created to confirm bookings--and fill in the blanks using the information from the spreadsheet. Once that info has been filled out, I copy and paste the entire text file into an an email and email it to the client for his confirmation/records. The email template text (txt) file I use is included below.
    Question: Is it possible to create a script that will read the specified row in my Numbers booking spreadsheet (ie, the row where I input the information in the spreadsheet) and have the information inserted into the separate text confirmation template (apple pages or text or email?) at specified areas within the text? If so, can someone help me make something like this? Here's the template I use:
    Hi clientnamehere
    It was nice chatting with you. And thanks again for choosing us for your photography needs.
    For your convenience, I've outlined the details of your booking below. Please ensure everything looks OK:
    _Order Confirmation_
    As discussed, we've booked the following services:
    - [deletethose_that_don't_apply_incl_thisnote]
    - real estate photos
    - upscaling photos
    - virtual tour
    - hd video tour
    - customizable slideshow
    - floor plans
    - brochure design, print, & delivery
    - virtual staging
    - photoshop touchups
    For the following location:
    - property_address, city, postal_code
    On the following date and time:
    - month_date at time
    Note: If any of the above is incorrect in anyway, please email us asap.
    concision edit
    Message was edited by: thebigother

    Let's begin with your first question:
    I've tried to change the "Template.txt" file into an rtf so that I can apply bolding and underlining to certain sections (ie, bolding to the entries like client_name, job_date, etc... and underlining to the "Steps"), and I changed the script from Template.txt to Template.rtf to reflect this change... but when I run a script I get a bug... is there any way to use an rtf file in place of the txt?
    The following script should work with an RTF file, provided you don't mind using [GUI Scripting|http://www.macosxautomation.com/applescript/uiscripting/index.html] (in blue below). Before running the script, you will have to enable the Accessibility Frameworks by clicking the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane.
    *set theTemplate to POSIX file (POSIX path of (path to desktop) & "Template.rtf")*
    *tell application "Numbers"*
    *   tell table 1 of sheet 1 of front document*
    *      set theValues to value of cells of row 1 of selection range*
    *   end tell*
    *end tell*
    *tell application "TextEdit"*
    *   open theTemplate*
    *   set theText to text of front document*
    *end tell*
    *set theText to replace("clientnamehere", item 1 of theValues, theText)*
    *set theText to replace("property_address", item 2 of theValues, theText)*
    *set theText to replace("city", item 3 of theValues, theText)*
    *set theText to replace("postal_code", item 4 of theValues, theText)*
    *set theText to replace("month_date", item 5 of theValues, theText)*
    *set theText to replace("at time", "at " & item 6 of theValues, theText)*
    *tell application "TextEdit"*
       activate
    *   tell application "System Events"*
    *      keystroke "a" using command down* -- “Select All”
    *      keystroke "c" using command down* -- “Copy”
    *   end tell*
    *   close front document without saving*
    *end tell*
    *tell application "Mail"*
       activate
    *   make new outgoing message with properties {visible:true}*
    *   tell application "System Events"*
    *      keystroke tab & tab & tab & tab & tab* -- five 5 text fields at most
    *      delay 0.25* -- adjust if necessary
    *      keystroke "a" using command down* -- “Select All”
    *      keystroke "v" using command down* -- “Paste”
    *   end tell*
    *end tell*
    *on replace(X, Y, theText)*
    *   set P to offset of X in theText*
    *   set L to length of X*
    *   tell front document of application "TextEdit"*
    *      delete (characters (P + 1) through (P + L - 1))*
    *      set character P to Y*
    *      return its text*
    *   end tell*
    *end replace*

  • BUG:  Advanced Actions duplicated when creating NEW PROJECTS FROM TEMPLATE using Adobe Captivate 8.

    Need:  CREATE NEW PROJECTS FROM TEMPLATE using Adobe Captivate 8. 
    Problem:  NEW PROJECT (.cptx) duplicates the Advanced Actions originally configured within TEMPLATE FILE (.cpt.).
    For example: Template file (.cptl) advanced action "_initializeModule" gets duplicated as "_initializeModule1", "_initializeModule2", "_initializeModule3" within NEW PROJECT.  FYI, the original "_initializeModule" advanced action still appears.
    MAJOR BUG, what the heck is going on?!?!!!  Planning to deploy this template file to use for multiple courses with multiple users, this WILL cause epic confusion across the board.

    Similar problem, think they are working on it as well: when dragging a shared action from an external library to a slide or object event, and that action is using a parameter that was already created for another shared action, there will be a new parameter created which really screws up the shared action contrary to this problem. Tip: for the moment do not drag shared actions from an external library immediately to an event, but drag them first to the Library: Reuse Shared Actions in other Projects - Captivate 7 vs. 8 - Captivate blog

  • How to Create a OLAP Cube in DEV using SSAS from Raw file system backup from Production?

    How to Create a OLAP Cube in DEV using SSAS from Raw file system backup from Production? I dont have a .abf file available. Two paritions in production are missing data. We were able to get back file system backup which contains the files for these two paritions.
    How do I create a cube in Dev using this file system backup.
    we are on SQL Server 2008R2.
    Thanks,

    How to Create a OLAP Cube in DEV using SSAS from Raw file system backup from Production? I dont have a .abf file available. Two paritions in production are missing data. We were able to get back file system backup which contains the files for these two paritions.
    How do I create a cube in Dev using this file system backup.
    we are on SQL Server 2008R2.
    Thanks,

  • Automatically create new slide after pasting large block of text?

    Hello,
    Does anyone know if it is possible to have Keynote automatically create new slides if I paste text that doesn't fit into a single slide? The biggest time waster I've encountered is the apparent requirement to break up large chunks of text manually.
    If Keynote does not do this, any ideas as to an Applescript or something that could help?
    Much appreciated

    I usually try dragging from the bottom up in Web pages, it can be tricky getting at the part you want without the extraneous formatting, since that is concealed from you and web designers use many different methods for layout.
    That's why pasting into a plain text document is a good idea to shake off the web formatting, otherwise you are groping around whatever Pages has interpreted the formatting to mean. Even browsers don't get this all right.
    If the original was formatted as a table which won't fit one of the cells on a Pages page, it just pops and won't continue because Pages does not allow breaks in mid cell. If the cells are small enough to fit and you have pasted the table inline in the main text body of a WP file (between the margins) it will flow.
    Peter

  • Create a visual web part which get data from excel sheet and import it into sql server database in sharepoint 2010 (development)

    Hi,
    I want to create a visual webpart which will read data from excel sheet and import it in to sql server database.(using sharepoint development)
    I want to do it using visual webpart.
    Please help to solve the issue.
    Thanks in advance!
    Regards
    Rajni

    Hi  Rajni,
    Microsoft.Office.Interop.Excel assembly provides class to read excel file data, in your web part solution, reference the assembly, and following blog contains samples about how to read the excel file data,
    and import it to SQL  database.
    1.Create a Visual Web Part Project:Create
    Visual Web Parts in SharePoint 2010
    2.Read the excel workbook by using SPFile class:
    http://alancejacob.blogspot.in/2012/06/read-data-from-excel-file-and-insert-in.html
    http://stackoverflow.com/questions/14496608/read-excel-file-stored-in-sharepoint-document-library
    3.Export the excel workbook to SQL Server:
    http://www.c-sharpcorner.com/UploadFile/99bb20/import-excel-data-to-sql-server-in-Asp-Net/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • How to create new Custom XML Report without using Form Builder

    Hi,
    What are the steps to create new Custom XML Report without using Report Builder ?
    Thanks and Regards,
    Abhi

    Hi,
    Steps we now follow
    1)Create Data Model in Reports Builder
    2)Create xml
    3)Insert xml in Publisher to build Fomat
    4)FTp rdf
    5)Create Data Definition and Template
    6)Create executable and Concurrent Program
    Is there any way we can build reports without use of Report Builder ? By writing PL SQL Package for Before Report and After Report etc ...
    Thanks and Regards,
    Abhijit Rode

  • Problem in creating new versions for existing DIR using CV01N

    I am working in SAP ERP 6.0 EHP 4.0 system.
    I have problem in creating new versions for existing DIR using CV01N
    I create a DIR version 00 with functional location and mpd cycles. Then when i try to create a new version by copying the contents created from already created document.I change the MPD cycles in the new version and save it.
    once when i display the first document created the mpdcycle specified in version 01 is copied to the 00 version.
    The document is inconsistent where versioning of document doesnot work properly wrt MPDCYCLE and MP HEADER.
    The problem which i found was the document identification guid remains the same for all the document versions getting created.
    The same is working fine in SAP ERP6.0 EHP3.0 sytem.
    Please someone help me in resolving the above issue.
    Regards,
    Prasad.B

    There is a change in the standard code.The reason for the above problem was  because of a missing Enhancemnet point in a standard function module 'CV110_DOC_CREATE_WITH_TEMPLATE'.
    IS-ADEC-MPD  - Enhancement to copy MPD data
    ENHANCEMENT-POINT CV110_DOC_CREATE_WTEMPL_01 SPOTS ES_SAPLCV110.
    +*$*$-Start: CV110_DOC_CREATE_WTEMPL_01----------------------------------------------------------$*$*+
    +**ENHANCEMENT 1  ZSF_AD_MPD_SAPLCV110.    "active version**+
    +*** copy MPD relevant data from templ. doc to current doc**+
      +**CALL FUNCTION 'MPD02_COPY_MPD_DATA'**+
        +**EXPORTING**+
          +**is_draw = ls_draw**+
        +**TABLES**+
          +**ct_drad = lt_drad.**+
    +*ENDENHANCEMENT.**$*$-End:   CV110_DOC_CREATE_WTEMPL_01----------------------------------------------------------$*$*+
    Created a custom enhancement point similar to SAP ECC6.0 EHP 3.0 system.
    The reason was the buffer was not getting cleared previously.After inserting the above code the DIR's are getting created withot any issues.
    Regards,
    Prasad.B

  • Not able to create new e-mail on N8 using Mail for...

    Not able to create new e-mail on N8 using Mail for Exchange.
    Currently using google for my domain, but settings are the same as explained on the google Sync webpage: http://www.google.com/support/mobile/bin/answer.py?hl=en&answer=147951
    When creating reply on mail the application crashes.  When creating new mail it says "Kan bewerking niet uitvoeren" in english: "Unable to execute action".
    Any idea why creating mail is not possible?
    Regards,
    Joris

    problem is known
    more info there:
    /t5/Nseries-and-S60-Smartphones/N8-syncing-with-Google-contacts-amp-calendar/td-p/772020
    there is little workaround aslo.

  • When capturing footage is there a way to automatically create new clips...

    When capturing footage in Final Cut Pro is there a way to automatically create new clips like it does in iMovie. I have to capture over 9 hours of footage and I dont want to spend the time logging each clip. I also dont want to just capture the whole tape then go back and log each clip. I really like how iMovie automatically creates a new clip each time the rec/pause button was pushed. is there anyway I can get Final Cut to do this??????

    You can capture the complete clip and then apply Mark > DV Start/Stop Detect over the captured clip. You could get the best of two worlds so: smooth capture and clips creation.

  • Filtering using data from a spreadsheet in WebI

    I need to convert a BO6.5 Full client report to a BO XI R3.1 WebI report.  The report needs to use data from an Excel spreadsheet to filter data from a universe, and in 6.5 this was achieved by creating a universe for the spreadsheet data and using 'Select Query Results' as an operand returning this data in the report conditions.  When we put this report through the conversion wizard the conversion fails.
    Are there any other techniques that can be used in WebI that would allow me to use a spreadsheet to filter / join with a query from a 'regular' universe?
    Thanks,
    Steve Clarke

    Thanks for the response! I'd be interested in writing a script for it (I've actually been researching it a bit already). I'm completely new to Javascript (and scripting) but have a fair level of experience with c/c++ so I feel it shouldn't be too bad. I'll ask here for now, just let me know if I should ask a new question on the scripting forum instead.
    I've looked at the Acrobat JavaScript API Reference (http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_api_reference.pdf) a bit but am having trouble finding a way to read the spreadsheet's data in (I was planning on using a csv file). I found Doc.importTextData(), which can parse a tab delimited file and from the sounds of it fill in the forms automatically (though I would much prefer a c style file interface that lets me write the parsing logic). Every time I try to call importTextData it returns -1 though, which means "Warning: User Canceled File Select". When I call it direct from the JavaScript Debug Console I just get a -1, but when I have it execute when I save I get "NotAllowedError: Security settings prevent access to this property or method.". I did a bit of research on that and modified my script to look like:
    Autofill = app.trustedFunction(
        function ()
            app.trustedFunction(importTextData);
            app.beginPriv();
            var result = this.importTextData("test.csv", 0);
            app.endPriv();
            return result;
    I've also tried running Acrobat as an administrator, but I still get the same error. I could just not be understanding privileges correctly.
    My overall plan was:
        for each row in the spreadsheet
            - read the row in from the file
            - fill out the fields in the PDF using the read data
            - save the file with a new file name.
    If there is a better method to do this, just let me know.
    Thanks again for your time!

  • How to use data from standard view in Web dynpro for ABAP

    Hello:
    I have to create an Abap Web Dynpro, and I must use data from a standard view in the new one. Does anybody know what do I have to do?
    Thank you and have a happy new year.

    Hi Rodrigo,
    Firstly, list the Standard component under Component Usage of the Component which you are creating in your View.
    Second, In the Custom Component, view, goto context, and try to add the node from the Standard component in to your view.
    NOTE: The second step requires a Node in component controller of the Standard Component.
    Finally, Now in your view, get the data from that and map the data.
    NOTE: To do this, I think you need to call your Standard WDA first and then only your node contains data and it will be passed.
    I hope it is helpful.
    Regards,
    Shashikanth. D

  • Have a combobox pre-filled using data from database

    What would be a recommended method to have a combobox
    pre-filled using data from database?

    You can load an Array with the data returned from your
    database and bind to that array as the dataProvider for the
    comboBox.
    [Bindable]
    private var myArrayDP:Array = new Array();
    //Load the array with your returned data.
    <mx:ComboBox dataProvider="{this.myArrayDP}">
    </mx:ComboBox>
    Using an ArrayCollection however is often better if you want
    changes to the dataProvider to automatically reflect in the
    ComboBox.

  • How to get useful data from request?

    Hello.
    I am looking for creating a management tool for a web site. All I want is that is there any ready to use API or package or open source project for retrieving user�s information? I just mean that is there any easy to use way in java to get useful data from a client (for example location, his or her system configuration and information �).
    Thanks.

    If you dump all the data from request (see the javadoc, and especially the "header methods" ) you'll see the data you can get are quite simple.
    The only thing you can try to rely on are ;
    - the IP address from the sender (when reversed to DNS, you can sometime use the tld to locate the country it comes from. Yet, you'll get many .com name, so it's not that significant. it may also give you the IAP used). Note that if the user is using a proxy, it's the proxy IP that you'll collect
    - the User-Agent header : from this, you can guess the OS and the browser used
    - the Referer header : usefull to get where your user comes from (where they found a link to your site)
    - the Cookie header : if you're using a servlet container with session id stored in cookie, you should see the Cookie header appear on the second request to your site. That helps finding out wether your user accep cookie or not (from a server point).
    Besides these, i don't think you can get any other useful data without asking your users on a form. Note that it's the client that decides to send Referer, User-Agent or Cookie headers. Those are not mandatory to the Http Protocole and some browser allow their user to fool their content (butmore than 90% of the widespread browsers don't)

  • I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. years each month.

    I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. year each month. I need to create a spreedsheet using the the Acutlas from the year-to-date and from last year-to-date, but need to report each month.

    Hi Tony,
    Answering your question would be easier given a screen shot of the source table and one of what you want the summary table to look like.
    Is the data you want for each month in a single cell o the source table, or does the summary table need to collect February's data (for example) from several cells and do some math with those numbers before presenting them on the summary table?
    Regards,
    Barry

Maybe you are looking for

  • Message Level Security in XI  7.0

    Hi, Have someone worked on Message level Security in XI 7.0 for transferring a file from one system to an external third party system? If so can u provide me with links or documents? Thanks Manjula

  • JCo connection between java and ABAP

    Hi, Any pointers for some good material on establishing JCo connection between ABAP and Java to execute ABAP FMs. Thanks and Regards Arpita Saxena

  • Warp Stabilizer crops bottom of video if videos layers are beneath it for no reason.  Why???

    Warp Stabilizer crops bottom of video if videos layers are beneath it for no reason.  Why??? remove the layers beneath and it's fine.  Hopefully adobe addresses this issue asap to save all of us a good amount of time.

  • Table of contents problems

    I am trying to convert a document from Word to Pages. I've run into a some table of contents problems that I know how to solve in Word, but which apparently cannot be solved at all in Pages. 1. I need to make several entries differ from the paragraph

  • ISE WLC DACL Flex

    ISE 1.2 Patch 2 VWLC 7.4.100.0 Specifically flex connect APs We have successfully built the first self registration MAB'ed Z policy which authorizes all MACs to hit the CWA and a redirect. WIth Flex you must have an IPV4 and a Flex ACL on the control