+ Reply to Thread
Results 1 to 8 of 8

Macro to attach personal files in the trouble ticket system

  1. #1
    Registered User
    Join Date
    09-18-2020
    Location
    Prague
    MS-Off Ver
    Office 2018
    Posts
    4

    Macro to attach personal files in the trouble ticket system

    Dear all,

    I have a big issue to solve. I created a macro that opens and fills automatically tickets with information present in the excel file.

    The only information I cannot add by the macro is an attached pdf. Every ticket will have the personal pdf related to each row (the pdf is stored in another folder).

    Is there a way to tell the macro to pick the correspondent pdf and attach in the ticket? So far, it works perfectly in inserting the cc, tags, title (short description and so on). Is it possible to make the same with attachments?

    Many thanks,
    V87

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Macro to attach personal files in the trouble ticket system

    based on your question, it's tough to answer without seeing at least SOME code. to point to a PDF and have a user open it, put a hyperlink in the appropriate cell and when a user hovers over, they can open the doc immediately with whatever default program is set in WIN to open .PDF extensions. to add a hyperlink with code (only partial code):
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-18-2020
    Location
    Prague
    MS-Off Ver
    Office 2018
    Posts
    4

    Re: Macro to attach personal files in the trouble ticket system

    Thank you so much for your answer.

    This is the code so far:

    'in the "short description" box in trouble ticket system macro fills in the value from the data set (wsca.Cells(i, 1).Value) and the title "Background Check Request"
    ie.document.all("short_description").Value = wsca.Cells(i, 1).Value & " - " & "Background Check Request"
    Do Until ie.readyState = 4
    DoEvents
    Loop


    Do Until ie.readyState = 4
    DoEvents
    Loop


    'ideally, with this code macro should take from this folder each related document, that is called always in the same way, changing the value ""wsca.Cells(i, 1).Value BGC" (e.g. John Smith BGC or Mary Brown BGC). The macro should take the document and put in the trouble ticket attachment space (see following screenshot). So far, the code does not work.
    ie.document.all("Attachment").Value = "\\Ant\dept\HR_Services\ERC\New_Hires\Extended Onboarding\APAC\BGC Macro\BGC Candidates document\" & wsca.Cells(i, 1).Value & " BGC.pdf"
    Do Until ie.readyState = 4
    DoEvents
    Loop

    Do Until ie.readyState = 4
    DoEvents
    Loop

    Ideally, in the attachment field automatically it should appear the address where to pick.
    Let me know if it does clarify to you.

    Many thanks,
    Amedeo

    attachment tt.JPG

  4. #4
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Macro to attach personal files in the trouble ticket system

    what is that an image of? a webpage? a forum? an upload dialog box on a webpage that is requesting you upload documents to its server using the windows directory browser button provided by the web app?

    and what do you mean by this?
    So far, the code does not work.
    ie.document.all("Attachment").Value = "\\Ant\dept\HR_Services\ERC\New_Hires\Extended Onboarding\APAC\BGC Macro\BGC Candidates document\" & wsca.Cells(i, 1).Value & " BGC.pdf"
    it looks like you are trying to put the file path of the PDF that's on one of your internal network's mapped drives to into the ""choose a file"" textbox in the image. is that what you want?

    if that is indeed what you are trying to do, and your attempt is this code:
    Please Login or Register  to view this content.
    more than likely it is not working because the textbox does not have the name attribute called attachment associated with it. when you use the .all property of a webpage's DOM (document object model), I think the referencing code to an element following it, in () parenthesis, requires the name attribute value. either that, or the id attribute. Either way though, a popup dialog (window that opens to select a file from your system) is not part of the DOM and therefore has no elements on it.
    Last edited by vba_php; 09-19-2020 at 06:35 AM.

  5. #5
    Registered User
    Join Date
    09-18-2020
    Location
    Prague
    MS-Off Ver
    Office 2018
    Posts
    4
    Quote Originally Posted by vba_php View Post
    what is that an image of? a webpage? a forum? an upload dialog box on a webpage that is requesting you upload documents to its server using the windows directory browser button provided by the web app?
    It is a Trouble Ticket page. Indeed, it is a web page.

    Quote Originally Posted by vba_php View Post
    it looks like you are trying to put the file path of the PDF that's on one of your internal network's mapped drives to into the ""choose a file"" textbox in the image. is that what you want?
    exactly, this is what I would like to get. In that attachment box I would like it appear the document path I put in the code, whit every correspondant employee id, different per each row of the database.

    Quote Originally Posted by vba_php View Post
    If that is indeed what you are trying to do, and your attempt is this code:
    Please Login or Register  to view this content.
    more than likely it is not working because the textbox does not have the name attribute called attachment associated with it. when you use the .all property of a webpage's DOM (document object model), I think the referencing code to an element following it, in () parenthesis, requires the name attribute value. either that, or the id attribute. Either way though, a popup dialog (window that opens to select a file from your system) is not part of the DOM and therefore has no elements on it.
    So, what shoud i put instead of "all"?

    Thanks a lot,
    Amedeo

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Macro to attach personal files in the trouble ticket system

    Amedo,

    you said this:
    Quote Originally Posted by Vii87 View Post
    exactly, this is what I would like to get. In that attachment box I would like it appear the document path I put in the code, whit every correspondant employee id, different per each row of the database.
    and I told you that more than likely you can't do this because that box is not part of the webpage's code. but I have done some research for you, and here is what I found. Go to this webpage:

    https://www.roberthalf.com/job/los-a...243-usen/apply

    and when you get there, click on the link with the words Upload Your Resume. you will see the same type of box pop up that you're dealing with at the moment. now, before you do that though, right click on the actual hyperlink text with those words in it and select from the menu: inspect element. you will see a window with the code highlighted that is relevant (see image 1 below). now, click on the grey button located on the right end of that line of code. when you do that, you will see something similar to what I am showing you in image 2 below. now, copy the words in that window: uploadResumeClick and right click on the actual webpage and select ""view source"". that will show you all of the code written by the client side. search the code for this: src=. when you search for that, it will show you all of the lines of code whereby the javascript libraries and/or functions are coming from.

    I did it for you, and found all of them. When you do it, you will find that all of these pages are relevant:

    https://www.linkedin.com/mjobs/awli/awliWidget

    https://www.roberthalf.com/sites/def...hU6iqSZPgn8.js

    https://www.roberthalf.com/sites/def...6eVGS_vnic0.js

    https://authorizeme.roberthalf.com/r...ogin_widget_js

    https://www.roberthalf.com/sites/def...BTax-NF0COA.js

    https://www.roberthalf.com/sites/def...Xy-dCmORyac.js

    now, when you search all of that code for what you want, which is the function uploadResumeClick, you will see that it is found in the 2nd to last file I just mentioned above (see image 3 below). and what you'll notice is that the function is 3 lines of code long. this line is what is popping up the box:

    $('#rh_resume_upload_file').show();

    I will stop the lesson here. more than likely you can't reach the input box you want because VBA can only see the traditional DOM (document object model) offered by traditional javascript, and jQuery is a semi-sophisticated extension of the original javascript language. However, I'm NOT saying that it's not possible. It very could be. But I'm guessing this is a little over your head at this point. I simply wanted to show you what you're dealing with.

    Does that make sense? Does it help you get other ideas of how to accomplish your goal?
    Attached Images Attached Images
    Last edited by vba_php; 09-19-2020 at 11:17 PM.

  7. #7
    Registered User
    Join Date
    09-18-2020
    Location
    Prague
    MS-Off Ver
    Office 2018
    Posts
    4

    Re: Macro to attach personal files in the trouble ticket system

    Thank you so much,
    you have been super kind I am learning a lot.

    I got your point, and indeed the complicate thing is the fact it is external.
    I will try and let you know if it works

    Thanks a lot,
    Amedeo

  8. #8
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Macro to attach personal files in the trouble ticket system

    good deal! good luck with it. I love teaching others.

+ 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] Macro to select Files to attach
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-12-2020, 11:44 AM
  2. [SOLVED] Macro to attach all files in a folder
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-27-2019, 09:01 AM
  3. Attach files created by macro to an email
    By JesseSingh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-04-2016, 12:12 AM
  4. Bus ticket system using VBA
    By mtallbert in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2015, 05:52 AM
  5. Trouble Ticket system - shared workbook updates
    By gombi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2012, 04:54 PM
  6. Trouble with personal macro workbook
    By debspecs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2008, 01:41 PM
  7. Trouble with personal macro workbook
    By MGT2000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-11-2008, 04:19 AM

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