Posts by alring

    Hi all


    I have a workbook with a VLookup formula to a closed workbook. It works most of the time.:)

    But sometimes it returns #I/T in some rows. And it is not the same row from time to time. If I then open the closed workbook, then it works perfect.


    Can someone please tell me what is wrong and maybe how to fix it?:)


    Thank you in advance.


    Regards

    Mads A

    Hi,


    Try this:

    Remember to change Sheet Name And the number of Rows.

    Cell B37 is in the exsamble "501" and it shall find a folder named 501 Monte

    Cell B38 is in the exsamble "139" and it shall find a folder named 139 LWD


    Next time the numbers in the two celsl will be different and also the name on the folders.

    The folders that I want to find will always start with the numbers in the two cells, but will always has another text behind the numbers.

    The file I want to look in will always be Cell B37 follow by a dot follow by cell 38 follow by space follow by text. But that is type in cell B1 (Cells(1,2)).


    Hope this will explain. If not then just say that. :)

    Hi Carim


    Yea I have tried that, and it don't work for me.


    Here is the total code, with start up next part of code:

    Hi there,


    I have this formula in VBA to get data from at closed Workbook.

    mydata = 'H:\Orders\501 Mor\139 LWD\08 Documentation\[501.139 Monte Tidsplan.xlsm]Gantt'!B6:B25


    Right now a part of my VBA look like this:

    Code
    Path = "='H:\Orders\" 'Path to the file
    Path_1 = Cells(37, 2) & "\" 'Folder name "501 Mor"
    Path_2 = Cells(38, 2) & "\" 'Folder name"139 LWD"
    Path_3 = "08 Documentation\" 'folder in the Path
    File_1 = "[" & Cells(1, 2) 'Start of Workbook name "501.139 Monte"
    File_2 = " Tidsplan.xlsm]Gantt'!" 'End of workbook name
    
    cel = "B6:B25" 'Cells where data shall be take from
    mydata = Path & Path_1 & Path_2 & Path_3 & File_1 & File_2 & cel 'Path and Workbook name and Cells

    What I would like is that Path_ 1 will be "501" and then Wildcard. And Path_ 2 will be "139" and then Wildcard. So the code will look like this:

    Code
    Path = "='H:\Orders\" 'Path to the file
    Path_1 = Cells(37, 2) & "\" 'Folder name "501"
    Path_2 = Cells(38, 2) & "\" 'Folder name "139"
    Path_3 = "08 Documentation\" 'Folder in the Path
    File_1 = "[" & Cells(1, 2) 'Start of Workbook name "501.139 Monte"
    File_2 = " Tidsplan.xlsm]Gantt'!" 'End of workbook name
    
    cel = "B6:B25" 'Cells where data shall be take from
    mydata = Path & Path_1 & "*" & Path_2 & "*" & Path_3 & File_1 & File_2 & cel 'Path and Workbook name and Cells

    I hope this make sense, if not then please tell me. :)


    Thank you in advance for all your time and help. :)


    Alring

    Re: Print a PDF file using VBA


    Hi Kenneth


    I though so that Excel can't control Adope's printing menu. I have made the changes in Adope and all works perfect now. Thanks for your time and your help.

    Re: Print a PDF file using VBA


    Hi MrRedli and Kenneth


    Both of them works perfectly. Thank you to you both.


    Now I can see that both of the codes print the Pdf file in A4. Is it possible to have the code to prnt A3 as the PDF file are savede in??


    Thank you in advance.

    Re: Print a PDF file using VBA


    Hi Kenneth


    Thank you for the answer. Bur don't understand what you mean about the pass command line parameters. Where shall I put in the letters you write?


    Where in the code is the mistake that do that the code don't work??


    Thank you in advance
    /Mads

    Hi all


    I'm using Excel 2010 and have Adobe Reader 11.


    I'm trying to make a code in VBA that can print a specific PDF file. It's OK if the file opens first but it not necessary.


    The file name change from time to time but it’s written in a specific cell in Excel. Let us say that it’s A1 in sheet1. The path is the same every time so that can be written directly in the code.


    I have found this code on WWW but it doesn’t work for me.



    I do hope that someone can help me.


    Thank you in advance

    Re: Excel macro to print a section from word


    Hi cytop


    Thank you for the help. It works perfect.
    Maybe it's my word that now have a problem because if a section is on 2 pages then there come 3 pages out of the printer.
    But the macro works. THANK YOU.

    Hi


    I use Excel to open word documents and print the word document. I use this code to open word and to print it.


    Code
    Set wdApp = CreateObject("Word.Application")
        wdApp.documents.Open Filename:=aNameAndPath & Filename
            wdApp.Visible = True
    
    
        wdApp.ActiveDocument.PrintOut , Copies:=1


    Now i have word documents that is divide into Sections. I would like to find a code so that it's only Section 2 in the word document that is been printed.


    Thank you in advance.


    Alring

    Re: Concatenate text in cells to a formula.


    Hi Batman


    You saved my day. Thank you for the help.


    As long as I in A1 write [min 2015.xlsm] and in A2 write Feb'!$C$9 then all is perfect. And as you said the other document have to be open.


    Regards
    Mads