+ Reply to Thread
Results 1 to 4 of 4

Archive Macro Help

Hybrid View

  1. #1
    Registered User
    Join Date
    09-29-2024
    Location
    Texas
    MS-Off Ver
    2024
    Posts
    11

    Archive Macro Help

    Hello, I am going to try my best to explain this and what I am needing exactly.

    I am working on creating a digital log for my job that has a "Day Shift" and "Night Shift" sheet where users will log in daily and input what happens on their shift. The file is in a .xlsm format. There are other sheets on this log but they will all be protected and used just for visual information like important phone numbers and hyperlinks to other stuff inside the company. No user inputs will happen on any other sheets except for the "Day Shift Log" and "Night Shift Log"

    I have started working on a macro that will archive the current sheet once a 24 hour time period has lapsed and then clear the unprotected cells.

    What I am needing now is code that will save a copy as to a specific "archive" file as read only. I only need the "Day Shift Log" and "Night Shift Log" sheets in the .xlsm file to save to this new file. I do not want to save each sheet as a separate document. They need to be on the same file just in their respective tabs. The save copy file name I need to read as "Frac 6 (current date -1). The reason for the minus 1 is the night shift is the one that will be archiving the log and therefore it will be the following next day. I need it to save as the previous day. Lastly, how can I make this copy "read only" with a password?

    After the "save copy as" I need to send these same two sheets only "day shift log" "night shift log" as an email attachment via outlook to my supervisor. If I can make these attachments .pdf that would be ideal.


    The rest of the macros I'm pretty much good on but these are the last two I am having trouble with.
    Last edited by MattyT92; 10-05-2024 at 08:24 AM.

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,309

    Re: Archive Macro Help

    Saving the 2 worksheets as a pdf...
    Sub Save_as_PDF()
        Dim fname As String
        fname = ThisWorkbook.Path & "\Frac 6 (" & Format(Date - 1, "yyyy-mmm-dd") & ")"
        Sheets(Array("Day Shift Log", "Night Shift Log")).Select
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fname
    End Sub

  3. #3
    Registered User
    Join Date
    09-29-2024
    Location
    Texas
    MS-Off Ver
    2024
    Posts
    11

    Re: Archive Macro Help

    Quote Originally Posted by dangelor View Post
    Saving the 2 worksheets as a pdf...
    Sub Save_as_PDF()
        Dim fname As String
        fname = ThisWorkbook.Path & "\Frac 6 (" & Format(Date - 1, "yyyy-mmm-dd") & ")"
        Sheets(Array("Day Shift Log", "Night Shift Log")).Select
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fname
    End Sub
    Will that just save my current workbook as PDF format? I need the origional log to stay in the same format (.xlsm). I need a copy of the two sheets to save also in .xlsm format just in a diffrent file location with a new name. The email is the only thing I am wanting to convert these two sheets to PDF format.

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,309

    Re: Archive Macro Help

    The pdf file is a copy of the worksheets.The original Excel file is unchanged.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Archive Macro - Student Data
    By KristofferA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2017, 07:28 AM
  2. Excel VBA Archive Monthly Account Returns to an Archive File
    By cmarenco in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-31-2016, 10:12 PM
  3. [SOLVED] Move row from sheet to archive in a macro
    By mmccra2858 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-22-2016, 09:58 AM
  4. [SOLVED] Teething problems with archive macro
    By infernojaffa in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-02-2015, 06:22 AM
  5. [SOLVED] Macro to replace values in an archive tab
    By CheyM in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2013, 12:37 PM
  6. [SOLVED] Excel97 macro to archive Outlook mailbox
    By Geo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-21-2005, 05:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1