Results 1 to 3 of 3

Thread: Help With Coding Please

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2012
    Posts
    1

    Help With Coding Please

    Hi All,

    I am currently trying to write some simple code in Excel in order to paste some excel tables into word one after the other with a space in between each.

    I am getting there however I cannot get a space in between in the tables which is rather frustrating me, can anybody please advise?

    Here is the code as I have currently written it - This is only for two of the tables another 5 also need to be incorporate however I will roll the code once I know how to get the space in between!

    Sub Macro1()
    '
    ' Macro1 Macro
    '

    '
    Range("A7:G28").Select
    Selection.Copy
    Set WordApp = CreateObject("Word.Application")
    WordApp.Visible = True
    Set WordDoc = WordApp.Documents.Add
    WordApp.Selection.Paste
    Application.CutCopyMode = False

    Range("A33:G54").Select
    Selection.Copy
    WordDoc.Paragraphs.LineSpacingRule = wdLineSpaceDouble
    WordDoc.Paragraphs.Add
    WordApp.Selection.Paste
    Application.CutCopyMode = False

    End

    End Sub

    If anybody can please advise I would be most grateful indeed.

    Thanks,

    Bejay

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Help With Coding Please

    Moved to the Office Development forum.

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Help With Coding Please

    you could try
    wordapp.Selection.TypeParagraph
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width