Results 1 to 9 of 9

Macro to prompt user for file name and save in location

Threaded View

  1. #1
    Registered User
    Join Date
    09-22-2011
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2007
    Posts
    18

    Macro to prompt user for file name and save in location

    Hi folks - looking for a bit of assistance with this one...

    We have a requirement to print a sheet of bar code labels and attach to a pallet of stock before shipping. I have the bar code scanner and this inputs data into an Excel spreadsheet. I have developed a bit of code which will remove duplicate lines, select a range of cells, and print the workbook, which works OK.

    I want to have the macro prompt the user to enter a file reference number (6 digit numeric),use this number as the file name of the workbook and save a copy of the file using this number in a network location (leaving the original file name and location as the working document).

    Here's what I have:

    
    'Prompt for dim sheet number
       
    Dim Dimsheetnumber As Long
    Dimsheetnumber = Application.InputBox("Enter the Dim Sheet Number", Type:=1)
            
               
    ' selectb1 Macro
    
        Range("B1").Select
        ActiveCell.FormulaR1C1 = Dimsheetnumber
        Range("B2").Select
                    
                    
    'Printout macro
                    
        Range("A2:B2").Select
        Range(Selection, Selection.End(xlDown)).PrintOut
        
        
    'Save a copy as Dimsheetnumber
            
            ChDir _
            "K:\Shipping\General Files\Bar Code Labels\Saved label sheets (Stored under dim sheet number)"
        ActiveWorkbook.SaveAs Filename:= _
            "K:\Shipping\General Files\Bar Code Labels\Saved label sheets (Stored under dim sheet number)\Dimsheetnummber.xlsx" _
            , FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
    This works to a degree, but doesn't use the entered number as the file name, and also saves the original working document with the new name and new location.

    I have attached the file also if this helps.
    Thanks in advance as always,
    J.
    Attached Files Attached Files
    Last edited by Fungijus; 11-21-2011 at 02:03 PM. Reason: Solved!

Thread Information

Users Browsing this Thread

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

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