Prev: Vista and AD Terminal Services Properties
Next: Retrieves last Changes users groups and computer objects
From: kidkosmo on 11 Feb 2010 17:33 Hi, Gang, I would like to use a VBA script in Access to attach files to a company wiki page, but I'm not having much luck. Admittedly, I am very green at doing this sort of thing and the Access group wasn't able to help me out much, so I'm hoping someone here could help. I think my problem is coming in with the Form that is used on the wiki page. Rather than having a text box to just enter the file path I want to upload, it has a 'Browse' button to capture the file path and a subsequent "Attach" button to attach the file. When I use the following code, I can only get the Browse window to open, but not to actually enter the path which was already captured by my database. Set ie = CreateObject("InternetExplorer.Application") ie.navigate strpath ie.Visible = True Delay (15) ie.Document.getelementsbyname("file_0")(0).Click 'the "ie.Document.all.Item("file_o").value = strFileName" does not return any action Delay (5) ie.Quit Any help would be greatly appreciated. The source code for the attach procedure is below, if it helps. <form method="POST" name="upload-attachments" action="doattachfile.action?pageId=20843682" enctype="multipart/form- data"> <table class="tableview" cellpadding="0" cellspacing="0" width="100%"> <tr> <th> </th> <th><span style="font: bold 14px Verdana, sans-serif;">Attach File</span></th> <th>Comment</th> </tr> <tr> <td valign="top">1.</td> <td> <input type="file" name="file_0" size="50"> <div class="stepdesc"> You cannot attach files with names containing '+' or '&' characters. </div> </td> <td>
From: David C. Holley on 11 Feb 2010 20:29 I don't believe that IE automation exposes a means by which you can directly fire events associated with a control. Hence you can't have Access 'click' a Browse or Submit button. If you've got the file path, you'd be better off digging into the Wiki to see if there's a way that you can directly copy the file to the server since in the end that's all that matters. "kidkosmo" <kidkosmo2(a)yahoo.com> wrote in message news:cad0fc5d-7a27-4e4a-bd7e-12efc4f29ac7(a)o8g2000vbm.googlegroups.com... > Hi, Gang, > > I would like to use a VBA script in Access to attach files to a > company wiki page, but I'm not having much luck. Admittedly, I am > very green at doing this sort of thing and the Access group wasn't > able to help me out much, so I'm hoping someone here could help. > > I think my problem is coming in with the Form that is used on the wiki > page. Rather than having a text box to just enter the file path I > want to upload, it has a 'Browse' button to capture the file path and > a subsequent "Attach" button to attach the file. When I use the > following code, I can only get the Browse window to open, but not to > actually enter the path which was already captured by my database. > > Set ie = CreateObject("InternetExplorer.Application") > > ie.navigate strpath > ie.Visible = True > > Delay (15) > > ie.Document.getelementsbyname("file_0")(0).Click > 'the "ie.Document.all.Item("file_o").value = > strFileName" does not return any action > > Delay (5) > > ie.Quit > > Any help would be greatly appreciated. The source code for the attach > procedure is below, if it helps. > > > > > <form method="POST" name="upload-attachments" > action="doattachfile.action?pageId=20843682" enctype="multipart/form- > data"> > <table class="tableview" cellpadding="0" cellspacing="0" width="100%"> > <tr> > <th> </th> > <th><span style="font: bold 14px Verdana, sans-serif;">Attach > File</span></th> > <th>Comment</th> > </tr> > <tr> > <td valign="top">1.</td> > <td> > <input type="file" name="file_0" size="50"> > <div class="stepdesc"> > You cannot attach files with names containing '+' or > '&' characters. > </div> > </td> > <td>
From: Tim Williams on 11 Feb 2010 22:27 The method used on your page is the only possible method for uploading files via a form on aweb page, and it's deliberately designed so that the file path is *not* settable via scripting. Your only option if you want to use that interface is to construct the POST yourself and send it to the server. However, that's not entirely simple to do. Tim "kidkosmo" <kidkosmo2(a)yahoo.com> wrote in message news:cad0fc5d-7a27-4e4a-bd7e-12efc4f29ac7(a)o8g2000vbm.googlegroups.com... > Hi, Gang, > > I would like to use a VBA script in Access to attach files to a > company wiki page, but I'm not having much luck. Admittedly, I am > very green at doing this sort of thing and the Access group wasn't > able to help me out much, so I'm hoping someone here could help. > > I think my problem is coming in with the Form that is used on the wiki > page. Rather than having a text box to just enter the file path I > want to upload, it has a 'Browse' button to capture the file path and > a subsequent "Attach" button to attach the file. When I use the > following code, I can only get the Browse window to open, but not to > actually enter the path which was already captured by my database. > > Set ie = CreateObject("InternetExplorer.Application") > > ie.navigate strpath > ie.Visible = True > > Delay (15) > > ie.Document.getelementsbyname("file_0")(0).Click > 'the "ie.Document.all.Item("file_o").value = > strFileName" does not return any action > > Delay (5) > > ie.Quit > > Any help would be greatly appreciated. The source code for the attach > procedure is below, if it helps. > > > > > <form method="POST" name="upload-attachments" > action="doattachfile.action?pageId=20843682" enctype="multipart/form- > data"> > <table class="tableview" cellpadding="0" cellspacing="0" width="100%"> > <tr> > <th> </th> > <th><span style="font: bold 14px Verdana, sans-serif;">Attach > File</span></th> > <th>Comment</th> > </tr> > <tr> > <td valign="top">1.</td> > <td> > <input type="file" name="file_0" size="50"> > <div class="stepdesc"> > You cannot attach files with names containing '+' or > '&' characters. > </div> > </td> > <td>
From: kidkosmo on 12 Feb 2010 10:12
On Feb 11, 8:27 pm, "Tim Williams" <timjwilli...(a)comcast.net> wrote: > The method used on your page is the only possible method for uploading files > via a form on aweb page, and it's deliberately designed so that the file > path is *not* settable via scripting. > > Your only option if you want to use that interface is to construct the POST > yourself and send it to the server. > However, that's not entirely simple to do. > > Tim > > "kidkosmo" <kidkos...(a)yahoo.com> wrote in message > > news:cad0fc5d-7a27-4e4a-bd7e-12efc4f29ac7(a)o8g2000vbm.googlegroups.com... > > > > > Hi, Gang, > > > I would like to use a VBA script in Access to attach files to a > > company wiki page, but I'm not having much luck. Admittedly, I am > > very green at doing this sort of thing and the Access group wasn't > > able to help me out much, so I'm hoping someone here could help. > > > I think my problem is coming in with the Form that is used on the wiki > > page. Rather than having a text box to just enter the file path I > > want to upload, it has a 'Browse' button to capture the file path and > > a subsequent "Attach" button to attach the file. When I use the > > following code, I can only get the Browse window to open, but not to > > actually enter the path which was already captured by my database. > > > Set ie = CreateObject("InternetExplorer.Application") > > > ie.navigate strpath > > ie.Visible = True > > > Delay (15) > > > ie.Document.getelementsbyname("file_0")(0).Click > > 'the "ie.Document.all.Item("file_o").value = > > strFileName" does not return any action > > > Delay (5) > > > ie.Quit > > > Any help would be greatly appreciated. The source code for the attach > > procedure is below, if it helps. > > > <form method="POST" name="upload-attachments" > > action="doattachfile.action?pageId=20843682" enctype="multipart/form- > > data"> > > <table class="tableview" cellpadding="0" cellspacing="0" width="100%"> > > <tr> > > <th> </th> > > <th><span style="font: bold 14px Verdana, sans-serif;">Attach > > File</span></th> > > <th>Comment</th> > > </tr> > > <tr> > > <td valign="top">1.</td> > > <td> > > <input type="file" name="file_0" size="50"> > > <div class="stepdesc"> > > You cannot attach files with names containing '+' or > > '&' characters. > > </div> > > </td> > > <td>- Hide quoted text - > > - Show quoted text - Hi, guys, Thank you for the great feedback. It sucks this couldn't be easier. Can I run this by you and get your thoughts? So, when the wiki page opens, the default focus is on the "comment" text box. I can right click in the "file_0" text box and paste in my file path and I can attach that file while bybassing the Browse dialog. Is there a way, to your collective knowledge, I can use the script to set focus to the "file_0" input without actually invoking the click (which opens the browse). If I could get there, I could copy my string to the clipboard and just use a paste command to paste it in. |