Posts by hfalstom

    Re: create a new word document based on a specific model (template)




    Tony,


    No results are shown in the result column.


    I ran the code with F8. It goes line by line to "If IsFileOpen("C:\papel carta.dotx") Then Exit Sub 'Change Your Template Path If Needed", then it jumps to "Function IsFileOpen(FileName As String)", goes line by line and comes back to "If IsFileOpen...." and then it exits.


    Word is closed, the path is OK, but nothing happens.


    Do I have to open the template first?

    Re: create a new word document based on a specific model (template)




    Tony, it did not open Word.

    Re: create a new word document based on a specific model (template)



    Tony, thank you very much!


    I will try it again later!


    The word template was in drive c:, and the cell had the right path and filename, but it did not work (no error message, but nothing was created). I even made a full search for new files, no results....


    I let you know.


    Once again, thank you very much for your help.


    Best regards,


    Herique

    Re: create a new word document based on a specific model (template)


    Quote from gn00588950;726916

    Hi Hfalstom,


    Please see if the attachment helps


    Hi GN!


    Thank you very much for your help.


    I tried to run your code, but I get an error message when imputing the file path. (invalid reference). This file path is where I want to save the file?


    I will keep trying to fix this.


    The save path will be the same as the template, does it help?


    If you can give me a hint of a little more help, I will appreciate a lot!


    Once again, thank you very much and best regards,

    Re: create a new word document based on a specific model (template)


    Quote from cytop;726913

    (Code snippet - needs revising)

    Code
    If Dir("c:\papel carta.dotx") = vbNullString Then
          Err.Raise 30010
       End If
       
       Set wd = New Word.Application
       
       With wd
          .Documents.Add Template:="c:\papel carta.dotx", Visible:=True
          ...
          ...


    The only way to name the document is when saving - just use ActiveCell.Text as the file name.


    Hi Cytop,


    Thank you very much for your help!!!!


    I could not make you code work, it comes back with an error about the object being not defined by user.


    I am very new to this kind of code, so I have no idea on how to correct this.


    I am "old school", I know only (and only a few) commands from the original Basic.


    I will keep trying, if you can help me a little more I will appreciate!


    Thanks and regards,

    Re: Creating a Word Document with Excel VBA


    Hi there!
    Sorry to ask this, but I am having trouble creating a word document named after the active cell and based on a specific template. After this document is created, the document should open.
    Does anyone have a code for that?
    Thank you very much!!