Excel macro downloading files - vba

I am currently making a macro that when i click on the button on the excel spreadsheet, it will go to this website and download the file onto my desktop and save it with the file name "flower.jpg". how would i go about doing this? the website i am downloading this file from is my own website using php coding and such, but i am kinda new to vba macro programming. please help.
i currently have this code but it always gives me an error which i have no clue what for.
my.computer.network.downloadfile(website link here, my desktop location)
Thank you

If you have a password protected site, try this code instead
my.computer.network.downloadfile(website link here, my desktop location, username, password)

Related

Write a log file using Powerpoint

My objective is to write a log file, once a user open a PPT file and Travers to different slides, system write this information in log file.
Till now I tried following solutions:
1. Create a Add-in (PPA) and attach it manually in PPT file.
2. Create a button on first slide and on click event call Auto-Open event.
But ultimately I want to implement a solution to install Add-in by making entry in REGISTRY.
I already read this great article http://www.pptfaq.com/FAQ00469_Add_-_install_an_addin_via_the_registry.htm
I work along with Abhishek on this. This addin is only available to the user logged in and loaded the addin via file->options->cutomize ribbon. But we want to make this addin machine specific so that we dont have to load the addin each time.
Thanks and Regards,
RS

Launch Userform when Outlook Template is opened

I have a User Access Request form that I created in Word, and have now been asked to replicate in an outlook email template. This .oft file will be placed on our website, so that when users click on the link, they will download the .oft file. When the user opens the file, an email with the User Access Request form in the body will load.
I was able to set up the bookmarks, and import the Userform from Word, and have even gotten everything to populate correctly in the email from the Userform...however I have hit a wall.
I can only get the Userform to appear when I run it from Visual Basic in the Developer tab.
What I am looking to do is have the Userform pop up as soon as the template is opened, and only when that specific template is opened by a user (I don't want the Userform to open if they are trying to create a new email, or when they open outlook, etc). I have tried adding a module with the Userform.show code, I have tried adding the code below into the UserForm's code as well, with no luck.
Private Sub UserForm_Activate()
UserForm1.Show
End Sub
Do you have any suggestions as to how I can get this to work properly?
Thanks in advance!
You will need your custom logic to be present on every user's PC in order for this to work. Since you have created a UserForm in your Outlook VBA project, you will need to copy that form and supporting macros to every user's Outlook VBA project.
Often it is better to develop a COM Add-in to host your logic, and deploy it using a Windows Installer package. Deploying the .otm file where the VBA is stored is not supported.
Looks like I was able to get it to work. I added the following code:
Private Sub Application_ItemLoad(ByVal Item As Object)
R1AccessRequest.Show vbModeless
End Sub
Worked beautifully... until I sent the template over to a colleague to test... Userform appears to be tied to my outlook, and didn't appear for him. We opened up VB on his laptop, and saw that the form was not present :( From what I have been able to gather online, it doesn't seem possible.

How to access an external application using vba which responds only to mouse clicks

I am trying to automate a task at work using vba where i load certain files to an application and generate a zip file. But this application doesn't respond to keyboard commands while loading a file. I'll have to double click the mouse next to the file name and select the file. Any idea how i can automate this using vba? I am not a great coder, so any kind of help would be appreciated.
Thanks in advance As shown in this picture, the select option appears only when i click the mouse in the specific tab, and I'll have to click again to select the file

Update Links Prompt Always Appears After Testing a VBA in my Personal Macro Folder

I was testing a VBA (found on this site) that opened a specific worksheet from a shared drive location(the doc did not have to be open). I tried putting it in my Personal VBA module so I could load this doc no matter which workbook I am in. After doing so, I get the "Update Links" Prompt every single time I open any new or older excel doc. that I have. I deleted the VBA code but I am still getting this prompt every single time.
Please help!
Go to Formula Tab and Click on "Names Manager" have a look if there are any named vars using the external link.
Good luck!

Add a Document_Open vba script to document when created from a template?

I have a template, Template.dotm, which is taken by a server and populated with data, then saved to a .doc. A user is then passed a link to this document so they can download it. I want to run a VBA script on that document when the user opens it.
Is there a way to accomplish this from within the template's vba script? The script of course runs fine if I simply double click the template to open an instance of it, but since the server saves a copy first, the script is gone by the time the user sees the document.
It turns out since the file was stored locally to the template but was being opened over the network, Word was confused and severed the connection to the template. I now have a copy of the template in a shared network drive, which I set to the attached template in Document_New.
Not the nicest solution, but it's working and was easy to implement. Thought I'd post for anyone who finds themselves in a similar situation.