Consulting

Results 1 to 3 of 3

Thread: Solved: Excel to Word: A few issues on the Excel part of things

  1. #1
    VBAX Contributor
    Joined
    Feb 2007
    Posts
    126
    Location

    Solved: Excel to Word: A few issues on the Excel part of things

    So I have a "Folder" with an Excel report sheet - "EXAMPLE.xls". I also have a "Sample.xls" outside of that folder which is my macro. I open it up, click on a white button there and it asks to select a folder, I select "Folder" and it asks user to select which files out of that folder to transform into a Word document... the whole thing works apart from 2 things....

    1) "In Module2" First I check for files in my Folder and assign listboxes their names. Unfortunately I can't figure out how to do the same thing without OPENING & closing the report file itself:

    [vba]For lngFileIndex = lngLwrBnd_c To fs.FoundFiles.Count
    Set wbcrnt = Excel.Workbooks.Open(fs.FoundFiles(lngFileIndex), False, _
    False, Password:="foo")
    UserForm.ListBox1.AddItem wbcrnt.Name
    wbcrnt.Close
    Next[/vba]

    2) "In UserForm" When I copy Range("A21:I32") from Excel to Word its just too wide and doesn't fit the page (tried landscape no luck either) how can I resize or what else can be done?

    [vba]wsOne.Range("A21:I32").CopyPicture Appearance:=xlScreen, Format:=xlPicture
    .TypeText Text:="Project Major Reviews & Dates"
    .TypeParagraph
    wrdApp.Selection.Paste[/vba]


    Thanks a lot for all your help!

    Much appreciated as always!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Point 1

    [vba]

    For lngFileIndex = lngLwrBnd_c To fs.FoundFiles.Count
    NextFile = Mid(fs.FoundFiles(lngFileIndex), InStrRev(fs.FoundFiles(lngFileIndex), "\") + 1)
    UserForm.ListBox1.AddItem wbcrnt.Name
    Next
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Feb 2007
    Posts
    126
    Location
    Thanks a lot, Part 2 I solved by pasting as [VBA]DataType:=wdPasteMetafilePicture[/VBA]

    Cheers!

    Mike

Posting Permissions

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