+ Reply to Thread
Results 1 to 8 of 8

Making a Macro to create a report in word

Hybrid View

  1. #1
    Registered User
    Join Date
    10-14-2008
    Location
    Shiloh, IL
    Posts
    4

    Making a Macro to create a report in word

    Hi, I have a multi-tabbed excel sheet that i would like to pull a report from the workbook is a work log for my technicians and i need to be able to range it by a start and end date. And if possable I would like it broke into to the set titles for the report sections I have 4 fields. all the sheets are formatted the same.

    Thanks
    Dennis

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Hi Dennis and welcome to he board
    Can you show us how far you already got ?
    Can you post a sample of your data and an example of what you want?

  3. #3
    Registered User
    Join Date
    10-14-2008
    Location
    Shiloh, IL
    Posts
    4
    The report would be broke down by the "type" field. I had it working using MySQL but my office suite does not support it.

    Dennis
    Attached Files Attached Files
    Last edited by draglin; 10-15-2008 at 01:10 PM.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    One easy method is to use FormFields. Here is an example.
    'http://www.mrexcel.com/forum/showthread.php?t=333200
    Sub FillForm()
      Dim wdApp As Object, wd As Object, rn As Long
      rn = ActiveCell.Row
      On Error Resume Next
      Set wdApp = GetObject(, "Word.Application")
      If Err.Number <> 0 Then
      Set wdApp = CreateObject("Word.Application")
      End If
      On Error GoTo 0
       
      Set wd = wdApp.Documents.Open(ThisWorkbook.Path & "\Car Information Page.doc")
       
      wdApp.Visible = True
      With wd
        .FormFields("Brand").Result = Cells(rn, "B")
        .FormFields("Model").Result = Cells(rn, "C")
        .FormFields("Chasis").Result = Cells(rn, "D")
        .FormFields("Engine").Result = Cells(rn, "E")
        .FormFields("Color").Result = Cells(rn, "F")
        .FormFields("YearMonth").Result = Cells(rn, "G").Value & "/" & Cells(rn, "H").Value
      End With
      
     Set wd = Nothing
     Set wdApp = Nothing
    End Sub

  5. #5
    Registered User
    Join Date
    10-14-2008
    Location
    Shiloh, IL
    Posts
    4
    I tried a few scripts and none of them pull from all tabs. The data I need is in column "B" the report is pulled by the date range in "A" and it would pull the hole row for the records that match.

    Dennis

  6. #6
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    You have not provided enough details to know what you are doing.

    Are you making a one record document or will it be like a mailmerge where multiple records create a many page document?

    In any case, I don't know how to help if I don't know your rules.

+ 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. Macro to create Pivots
    By Japi_s in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-16-2013, 04:40 PM
  2. Can a Macro generate a report?
    By Fowley in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2008, 08:40 PM
  3. Making a Report
    By Martyisbetter in forum Excel General
    Replies: 3
    Last Post: 08-07-2007, 05:31 AM
  4. Create word document
    By jonn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2007, 12:27 PM
  5. Help with a Macro (MS Word)
    By Push Latency in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2006, 01:37 PM

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