+ Reply to Thread
Results 1 to 9 of 9

DeBug error

Hybrid View

  1. #1
    Registered User
    Join Date
    08-22-2018
    Location
    Grand Rapids, MI
    MS-Off Ver
    2010
    Posts
    5

    Question DeBug error

    I have a Macro created but I am having issues with a string and cannot figure out what is the issue. My hope is that this string will export the 2 files listed( EE QA Form and TP QA Form) into a single PDF with the reps name listed in the title ( Range D9)...and if it can also include the date and time of the call being used which is in cell G13 and H13. Each time it is used it should create a new PDF file every time it is ran.

    What am I missing??



    Dim ref As String
     Dim filename1 As String
    
    Path = "T:\Consolidated_Call_Center_Reporting\Quality Reports\QA Forms\PDF\_"
     Sheets(Array("EE QA Form", "TP QA Form")).Select
         ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:="T:\Consolidated_Call_Center_Reporting\Quality Reports\QA Forms\PDF\_ " & Range("D9").Text _
          & ".pdf", openafterpublish:=False, ignoreprintareas:=False
         
                
        
         MsgBox "All PDF's have been successfully exported."


    ~Thank you for any help!
    Last edited by dominicb; 08-23-2018 at 10:17 AM.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,275

    Re: DeBug error

    Turtle,

    Welcome to the forum. Please use Code Tags when posting code.

    This works for me.
    Dim Path As String, filename1 As String
    
    Path = "T:\Consolidated_Call_Center_Reporting\Quality Reports\QA Forms\PDF\_"
    filename1 = Sheets("sheetnamehere").Range("D9").Text
    
    Sheets(Array("EE QA Form", "TP QA Form")).Select
    ActiveSheet.ExportAsFixedFormat 0, Path & filename1
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    08-22-2018
    Location
    Grand Rapids, MI
    MS-Off Ver
    2010
    Posts
    5

    Thumbs up Re: DeBug error

    Awesome! 1 more thing, in the field where it states where to pull the info from for the file name, is there a way to pull additional information in different cells and have that placed in the name as well. For instance, the date and time of the call as well as the name of the agent. So currently D9 is the name of the agent, but in G13 and H13 are the date and time of the call. Is that possible to add to the formula?


    filename1 = Sheets("TP QA Form").Range("D9").Text

    I tried adding it like this and it did not work:


    filename1 = Sheets("TP QA Form").Range("D9", "G13", "H13").Text
    Suggestions? Can it be done?
    Last edited by dominicb; 08-23-2018 at 03:34 PM.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,275

    Re: DeBug error

    Second request to use Code Tags when posting code. It is a violation of Forum Rule#3. To edit your previous post follow next guidelines.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    Please do this if you want to receive further help on your query.
    Last edited by bakerman2; 08-22-2018 at 04:50 PM.

  5. #5
    Registered User
    Join Date
    08-22-2018
    Location
    Grand Rapids, MI
    MS-Off Ver
    2010
    Posts
    5

    Re: DeBug error

    Alright, I believe I have added the code tag. Please let me know if it needs to be something different.

  6. #6
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: DeBug error

    Turtle1219

    Please edit post 3 and add the code tags. I have added them to your initial post for you.


    You won't get any further responses to this thread until you do.

    DominicB



    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE] [/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html
    Please familiarise yourself with the rules before posting. You can find them here.

  7. #7
    Registered User
    Join Date
    08-22-2018
    Location
    Grand Rapids, MI
    MS-Off Ver
    2010
    Posts
    5

    Re: DeBug error

    Thank you for the example, I was honestly a little lost, but think I got it now. Thanks again!

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,275

    Re: DeBug error

    Like this.
        With Sheets("TP QA Form")
            filename1 = .Range("D9").Value & _
                        .Range("G13").Value & _
                        .Range("H13").Value
        End With
    This will most likely give you an error since G13 and H13 are Date and Time values that will need replacing the / and : marks but it will give you a general idea.

  9. #9
    Registered User
    Join Date
    08-22-2018
    Location
    Grand Rapids, MI
    MS-Off Ver
    2010
    Posts
    5

    Re: DeBug error

    Awesome! Thank you!!

+ 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. debug error
    By speedstr in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-19-2018, 07:08 PM
  2. Debug Error
    By cartica in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-09-2015, 09:23 PM
  3. VBA Code Runs in Debug Mode But Returns Type Mismatch Error Outside Debug Mode
    By valerie.k.chiang in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2014, 03:48 PM
  4. debug error
    By VBisgreat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-21-2012, 02:12 PM
  5. if Then = debug error
    By garretonufer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2009, 04:00 PM
  6. Debug error 13
    By BillGoodman in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 06-23-2009, 03:12 PM
  7. Error Won't Debug
    By Trip in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-29-2006, 03:10 PM

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