Posts by beelener


    I am fairly new to Office VBA, so please be patient with me... :)

    Using VBA from Excel 2010, I am opening a Word document, to enter some tekst in some of the bookmarks of this Word document.
    By clicking on the first button everything works fine:

    The Word document remains open while the user goes to a second page of the form, enters some information and presses a second OK-button.
    Now below code does NOT work as the file is already open. A second word document is opened, where the info is added, while I want it to be added in the already open document.
    What needs to be changed to refer to the already open document?

    Re: Let user open excel doc and then rename it

    Quote from cytop;523572

    You'll have to rethink how you want to do this... or provide more information about the context of what you're doing.

    Thanks for your reply. I am automating the process of combining different sheets from different documents into one new document.
    The problem is that the different documents that I get every week differ in naming. So I want to find a way of renaming those files, so I can use these new names in my code for copying the different sheets.
    Of course one can rename the documents manually first, but I think it would be better/nicer to automate the process completely.
    Therefore I thought it would be a nice solution to have the user open the document asked for, and then rename it, after which the user is asked to open another of the documents, have this renamed, etc.


    I would like to ask (by MsgBox) to have the user to open a file (of which I don't know the name).
    After that I want to rename the file.

    I tried the following:

    MsgBox ("Open the file and click OK")
    ActiveWorkbook.SaveAs "newname.xlsx", FileFormat:=51
    MsgBox ("The file has been renamed")

    This does not seem to work. When starting the macro (from within another Ecel-doc) the process seems to stall and the file will not open.

    Can somebody tell me how to arrange for this?

    BTW: I am a real VBA-noob