Copy web content from Outlook to Excel using VBA - excel

My client receives an email with a one-time-access url each day (it can only be accessed once, and only on that day).
Content from this url is plain text formatted as a .csv (actually tilda sv) file, but that is not of relevance here.
The content is then (manually) copied and pasted into Excel sheet, where some (formatting) macros are applied (to get rid of tildas and put data into cells).
Also, few of the first rows of the content are irrelevant, i.e. only lines 5-end are copied into Excel.
My question is the following - is it possible to write a VBA in Outlook to
open the url provided in the given email
copy the content from the webpage (and remove those first couple of lines)
open Excel and paste it there (and apply formatting afterwards)
I found some answers on how to copy/paste content from the email itself into Excel sheet, but didn't manage to sort out how to do it from a url/webpage.

Yes it is possible
I am not expert on VBA, but I do little programing to reduce daily task
I can show you the steps:
create rule that triggers VB script when email arrives.
In the VB script in the outlook, write code that would open excel
pass the connection string
set the R1C1 as destination cell
Save the file as date variant .xls
Make sure outlook is open. This would not work if outlook is not open

Related

creating dynamic hyperlinks when importing data into excel

I am trying to automate a process where data is queried from the database, downloaded into an excel file and sent to recipients. One of the column in the excel file needs to be a hyperlink. How can i make this happen?
I selected =hyperlink(A,B) into the column but the function appears as text and not as hyperlink.
I tried changing the web options to 'update links on save' but it does not help.
Only when i click in the cell and hit enter does the hyperlink appear. This is not an option
Opening the file and adding a new column to use the hyperlink function is not an option either since the process is being automated.
The tool allows me to export into an xlsx and not a xlsm so i am assuming i cannot use macros to do the job.
I tried researching the answers for similar questions but didnt find any that i could use which will generate a url dynamically without me having to open the file. Any ideas?
I also tried another tool and they were able to send out emails with links. I do not know how they do it internally but i do not see any hyperlink functions when i tab into the hyperlink column.
Cell type should probably be set to "Generic".
You may also need to trigger a "Refresh" after the workbook is filled with all the data. Sometimes I need to that manually - but only once. I have no idea why it happens.

Amending a text file in Sharepoint via Excel VBA

I have an Excel spreadsheet on a Sharepoint site that I would like to keep as read-only. However, my users will occasionally need to add small amounts of data, which I thought could be best stored in a small text file. I can read the text data into the Excel userform easily enough, and I can amend the text file with new data equally easy - but only if I have already checked the text file out. This doesn't work for other users of course. Is there some method of checking out a file - which isn't a workbook - out via Excel VBA, or will I have to switch to storing the updateable data in another workbook?
It is possible to use VBA to read textfiles. You can use this example for instance: https://www.excel-easy.com/vba/examples/read-data-from-text-file.html where you can read the data per line.

Create dynamic link to embedded documents in Excel WITHOUT VBA

Firstly, I realise this problem could be solved with VBA, but I am looking to keep this workbook macro-free.
What I am trying to do is have several Excel workbooks embedded into my workbook (each embedded workbook is specific to a factory). I want to create a cell that acts as a dynamic hyperlink, which changes depending on which factory is filtered (I don't have any issues creating this dynamic hyperlink myself). The part I don't know how to do, is create a hyperlink that opens a document that is embedded within the workbook. I can make a hyperlink that opens a file saved in a directory, but I need to be able to share this workbook with multiple users, therefore I am embedding the documents.
Hopefully this makes sense - to summarise; I need to create a button/hyperlink that opens an embedded document WITHOUT VBA.
Many thanks
You have an EXCEL function HYPERLINK that receives a string (i.e. URL) as the first parameter. You can of course set BUILD the URL with a formula or a reference to other cell.
For instance, if you set in a cell the value:
=HYPERLINK("http://www.google.com")
and link on it, Google's page will be open on your browser. If you set the link to point to a file (any file) it will open it with the suitable application (e.g. Excel).
Is this what you were looking for?

Outlook macro that checks if Excel macro is running

I have an Excel macro that opens Internet Explorer, searches & requests an export for each item in Column A.
The export is sent to my Outlook email and automatically filters into my Import/Export folder. At that point, when it filters into my Import/Export folder, I'd like an Outlook macro to check if the Excel macro is running, because I receive exports at other times too.
If the Excel macro is running I'd like to change/edit the subject line of the email that was just filtered to include the text from a certain HTML tag (which I have the ID for) on the current page from Internet Explorer.
** Is this possible? If you have any suggestion on a better way to go about this I'd be happy to hear it.
In Excel, just before the first export save 1 to a text file. Once all exports are done, put Excel to sleep for a short time so the mail can reach Outlook then save 0 to the text file.
In Outlook, assume Excel is requesting exports if the text file contains 1.
Edit:
Sample code for Excel How to create and write to a txt file using VBA
Sample code for Outlook: Read/Parse text file line by line in VBA

Copy data from Excel to Word

I have a .csv file which I can export and from which I need to copy data into word.
I know how to get the relevant data from Excel and format my .csv file with VBA, however I don't know how to get my data from that Excel file to Word.
Basically this is how a line of my formatted .csv file looks (I Got rid of all the info I don't need).
For clarification: 1st long nr. is personnel 2nd one is token.
And I need to fill that info into the following table in word (Not everything gets filled in).
And one extra thing, depending on the extention of the email address #mc or #lmc, I need a different file opened (Different languages). How would I best do that?
Possible algorithm:
In your Excel document, develop a VBA macro that
Copy data/elements from Excel document
Open your word document
Paste excel data to word document (to the places you want)
Save word document
Close word document
Here is some code for inspiration of how to do that.

Resources