Results 1 to 8 of 8

Trying to link a variable to a public const

Threaded View

  1. #1
    Registered User
    Join Date
    09-06-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    11

    Trying to link a variable to a public const

    I have a list of file directories located on a second module using public const (I think this is a way to house the data?). On Module #1 I have a macro that has a prompt to enter text into an inputbox. Inside the inputbox I will be entering a name ie Andy. I would like to make a new variable that looks up Andy on the public const & defind that variable as the file directory for Andy. I am basically trying to automate saving an excel doc as a PDF to a specific folder base on the name I type into the inputbox. Can someone please help? Below are the macros I have now



    Module #1

    Sub PDF()
    
    Dim MyInput As String
    Dim Client As String
    Dim Location As String
    Dim Quarter As String
    
    This_Year = Year(Now())
    Report_Date = Right(Range("A4").Value, 10)
    
    If Format(Report_Date, "mm/dd") = "03/31" Then
    Report_Name = " 1Q " & This_Year & " Account Overview"
    ElseIf Format(Report_Date, "mm/dd") = "06/30" Then
    Report_Name = " 2Q " & This_Year & " Account Overview"
    ElseIf Format(Report_Date, "mm/dd") = "09/30" Then
    Report_Name = " 3Q " & This_Year & " Account Overview"
    ElseIf Format(Report_Date, "mm/dd") = "12/31" Then
    Report_Name = " 4Q " & This_Year & " Account Overview"
    Else
    Report_Name = "OD AO as of " & Report_Date
    End If
    
    MyInput = InputBox("Enter Client Last Name", _
    "MyInputTitle", "Enter your input text HERE")
    
    Client = MyInput
    
    Location = 'need to be able to link what I type into the InputBox & a list of Public Consts on another module'
    
    ActiveSheet.ExportAsFixedFormat _
    Type:=xlTypePDF, Filename:=Location & Client & Report_Name & ".pdf"
    
    ActiveWorkbook.Close
    
    End Sub

    Module #2

    Public Const Tim= "G:\Users\Tim\"
    
    Public Const Bob = "G:\Users\Bob\"
    
    Public Const Andy = "G:\Users\Andy\"
    Last edited by ttd; 09-26-2012 at 11:45 AM.

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