Posts by alring

    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
    1. Path = "='H:\Orders\" 'Path to the file
    2. Path_1 = Cells(37, 2) & "\" 'Folder name "501 Mor"
    3. Path_2 = Cells(38, 2) & "\" 'Folder name"139 LWD"
    4. Path_3 = "08 Documentation\" 'folder in the Path
    5. File_1 = "[" & Cells(1, 2) 'Start of Workbook name "501.139 Monte"
    6. File_2 = " Tidsplan.xlsm]Gantt'!" 'End of workbook name
    7. cel = "B6:B25" 'Cells where data shall be take from
    8. 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
    1. Path = "='H:\Orders\" 'Path to the file
    2. Path_1 = Cells(37, 2) & "\" 'Folder name "501"
    3. Path_2 = Cells(38, 2) & "\" 'Folder name "139"
    4. Path_3 = "08 Documentation\" 'Folder in the Path
    5. File_1 = "[" & Cells(1, 2) 'Start of Workbook name "501.139 Monte"
    6. File_2 = " Tidsplan.xlsm]Gantt'!" 'End of workbook name
    7. cel = "B6:B25" 'Cells where data shall be take from
    8. 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
    1. Set wdApp = CreateObject("Word.Application")
    2. wdApp.documents.Open Filename:=aNameAndPath & Filename
    3. wdApp.Visible = True
    4. 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

    Hi there


    I have aproblem that I do hope someone can help me with:
    In Cell A1 I have a part of a path as text: C\mads\private\
    In Cell A2 I have the rest of the path still as text: [min 2015.xlsm]Feb'!$C$9. This part of the path is getting information from cell C9 on Sheet Feb.
    In A3 I want to write the two parts of the path as a formula so I can get the informaion from document min 2015.xlsm ceel C9 on sheet Feb. Is that possible??


    Thank you in advance.


    Regards
    Mads Alring

    Re: Constant Date In Adjacent Cell On Enter


    Hi Dave


    I'm not sure what you mean but as I understand it then I can overrule that Excel write a new date (in cell B1) the day after when the document is opened again. But I don't know how many times the document have to open. As i understand you then I have to use VBA.


    Best Regards
    Alring

    Hi there


    In Cell A1 I want to write a name, then Excel shall write the date for today in cell B1. I know how to do that. The problem is that the formula I use in cell B1 is:
    [bf]=IF(ISTEXT(A1);TODAY();" ")[/bf]
    This formula will today write 28/2-08 but tomorrow the cell will change to 29/2-08 without changing the name in cell A1. How can make it so that cell B1 don't change tomorrow. Meaning how to make the date in cell B1 to be constant or fixed or what to call it.


    Thank you in advarce for the help.
    Alring