+ Reply to Thread
Results 1 to 8 of 8

Help: converting new sheets to word document

Hybrid View

  1. #1
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Help: converting new sheets to word document

    Hi

    is there a way to create a macro to automatically save new sheets as a Word document in a specific file

    also i have another code that may need help on

    ARowbot helped me yesterday with this code which I got to say with his fast response to my post i was very pleased with his/her help and can't say thank you enough

    Sub Auto_Quotes()
        Dim MyCell As Range, MyRange As Range
        Dim i As Integer
        
        Set MyRange = Sheets("Summary").Range("A2")
        Set MyRange = Range(MyRange, MyRange.End(xlDown))
    
    Application.ScreenUpdating = False
    
        For Each MyCell In MyRange
            Sheets("Template").Copy After:=Sheets(Sheets.Count)
                With ActiveSheet
                    .Name = MyCell.Value
                    .Range("B25").Value = MyCell.Value
                        For i = 0 To 8
                           .Range("G28").Offset(i).Value = MyCell.Offset(, i + 1).Value
                        Next i
                End With
        Next MyCell
        
        
    Application.ScreenUpdating = True
    
    End Sub
    i have attached a example document of my spreadsheet with the above code added

    Example2015 (1).xlsm
    but i need to add to it so it copys names and addresses from another sheet at the same time as copying the data from summary is this possible
    Last edited by Vaughan.jamie; 04-17-2015 at 08:20 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Help: converting new sheets to word document

    I have replied to this via private message as I didn't realise you had posted on the forum aswell. Here is the code that exported each sheet to pdf. Unfortunately I didn't know a way to save it to Word Doc.

    Sub Auto_Quotes()
        Dim MyCell As Range, MyRange As Range
        Dim i As Integer
        
        Set MyRange = Sheets("Summary").Range("A2")
        Set MyRange = Range(MyRange, MyRange.End(xlDown))
    
    Application.ScreenUpdating = False
    
        For Each MyCell In MyRange
            Sheets("Template").Copy After:=Sheets(Sheets.Count)
                With ActiveSheet
                    .Name = MyCell.Value
                    .Range("C1").Value = MyCell.Value
                        For i = 0 To 8
                           .Range("F11").Offset(i).Value = MyCell.Offset(, i + 1).Value
                        Next i
                End With
    
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            "C:\Users\arowbottom\Dropbox\Macros\" & MyCell.Value & ".pdf", Quality:=xlQualityStandard _
            , OpenAfterPublish:=False
            
        Next MyCell
        
    Application.ScreenUpdating = True
    
    End Sub
    If you wish to put the address etc in then I recommend setting out a box for that on your template before we help import the correct data to it.

  3. #3
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Help: converting new sheets to word document

    Hi ARowbot

    once again being a legend :-)

    any chance you have an idea for the code for the bottom question?

    thank you in advance :-)

  4. #4
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Help: converting new sheets to word document

    Create a space on the template where you would like each line of the address to go so that you're happy with the format when you export it and print it out and then upload that workbook and I will happily put the code in for you to transfer the addresses automatically.

  5. #5
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Help: converting new sheets to word document

    Example2015 (1).xlsm

    Hi ARowbot

    Please find attached the example sheet

    i have put where i need them going on the new template layout

    thank you so much for helping me with this

  6. #6
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Help: converting new sheets to word document

    You're very welcome. Hope this does what you want it to do!

    Sub Auto_Quotes()
        Dim MyCell As Range, MyRange As Range
        Dim i, j As Integer
        
        Set MyRange = Sheets("Summary").Range("A2")
        Set MyRange = Range(MyRange, MyRange.End(xlDown))
    
    Application.ScreenUpdating = False
    
        For Each MyCell In MyRange
            Sheets("Template").Copy After:=Sheets(Sheets.Count)
                With ActiveSheet
                    .Name = MyCell.Value
                        For i = 0 To 8
                            .Range("H28").Offset(i).Value = MyCell.Offset(, i + 1).Value
                        Next i
                        For j = 0 To 5
                            .Range("B7").Offset(j).Value = Sheets("Customer_list").Cells(MyCell.Row + 1, j + 1)
                        Next j
                End With
    
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            "C:\Users\arowbottom\Dropbox\Macros\" & MyCell.Value & ".pdf", Quality:=xlQualityStandard _
            , OpenAfterPublish:=False
    
        Next MyCell
        
    Application.ScreenUpdating = True
    
    End Sub
    Last edited by ARowbot; 04-17-2015 at 08:07 AM.

  7. #7
    Valued Forum Contributor
    Join Date
    11-12-2014
    Location
    Nottingham
    MS-Off Ver
    2013
    Posts
    383

    Re: Help: converting new sheets to word document

    Try not to post in 2 different threads! In regards to your latest question on http://www.excelforum.com/excel-prog...-included.html. This macro currently creates a sheet for every school in the summary sheet. It won't update the sheets. The easiest way is to probably delete existing sheets first and then just run this macro.

  8. #8
    Registered User
    Join Date
    05-13-2013
    Location
    Corsham, england
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Help: converting new sheets to word document

    Hi ok

    thats fine ARowbot

    that is what i am doing at the moment so will keep it to that

    cheers for all your help

    i will mark this as solved now

+ 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. Converting a Word mailing label document to an Excel
    By MYITCO in forum Excel General
    Replies: 0
    Last Post: 05-13-2013, 01:29 PM
  2. Replies: 3
    Last Post: 11-12-2010, 02:39 AM
  3. converting a MS word document to Excel
    By jon@karhu in forum Excel General
    Replies: 6
    Last Post: 02-10-2009, 02:55 PM
  4. Converting a Word Document to excel
    By KelB in forum Excel General
    Replies: 2
    Last Post: 03-13-2006, 05:10 AM
  5. Converting a Word document into an Excel one
    By Rageaholic in forum Excel General
    Replies: 2
    Last Post: 06-20-2005, 05:21 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