Consulting

Results 1 to 2 of 2

Thread: Sleeper: Creating a template "Installer"

  1. #1
    VBAX Regular Shrout1's Avatar
    Joined
    Sep 2004
    Location
    Maryland, USA.
    Posts
    37
    Location

    Question Sleeper: Creating a template "Installer"

    I am hoping to create a macro that automatically places the file (or template file) currently open into the templates folder.

    I know that the user can be prompted to perform a "Save As" but is there some way that, upon first execution of this file the user will be prompted with a window that says, "You need to install this file in order to use it" and then, if the user clicks "Ok" the file will make note of this action in an invisible sheet (thus changing the template itself) and save itself into the "Username/Application Data/Microsoft/Templates" folder?

    This would just make it a lot easier on the user...

    Thanks!

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Try something like this:

    Dim Path As String
    Dim FileName    As String
    Dim MyResponse As VbMsgBoxResult
    Path = "Username/Application Data/Microsoft/Templates"
        FileName = "MyName.xls"
        If Sheets("Sheet1").Range("A1").Text = "Created" Then
            'Do Something Here
            Else
            MyResponse = MsgBox("Do you want to install this program?", vbYesNo, "File Installation")
            If MyResponse = vbYes Then
                Sheets("Sheet1").Range("A1").Value = "Created"
                ThisWorkbook.SaveAs FileName = Path & "\" & FileName
            End If
        End If

Posting Permissions

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