Forum Discussion
excel
NikolinoDE Thank you for your help.
I tried to read briefly what is reported in the two links. Unfortunately it explains how to use excel and all its features, which I already know how to use, but unfortunately I have not found an answer in case of this non-dysfunction excel-outlook and excel-instrumental data recording program.
I can't find an answer regarding the formatting problem.
I try again...so I hope to find the answer to this problem.
Thank you for your help
P.
Try this example.
The example assumes that the e-mail and workbook are already open and copies the area from B2 to C6 into the e-mail - including all formatting.
So that the declaration of the variables is possible, please add references to the Word and Excel libraries to the project (in VBA via Extras / References).
Sub PasteFormattedTable()
Dim Doc As Word.Document
Dim wdRn As Word.Range
Dim Xl As Excel.Application
Dim Ws As Excel.Worksheet
Dim xlRn As Excel.Range
Set Doc = Application.ActiveInspector.WordEditor
Set wdRn = Doc.Range
Set Xl = GetObject(, "Excel.Application")
Set Ws = Xl.Workbooks("Mappe1.xls").Worksheets(1)
Set xlRn = Ws.Range("b2", "c6")
xlRn.Copy
wdRn.Paste
End Sub
'untested
add info:
The VBA editor is the development environment for your own VBA functions. To open it, press ALT + F11 in Outlook. If necessary, press CTRL + R to display the project explorer. This lists all modules belonging to the project.
Where do I add macros?
At the beginning there is only the module ThisOutlookSession, which you can see under Project1 / Microsoft Office Outlook Objects. Double-click the entry to open the module in the code window. You can copy all macros into this module. This concerns e.g. all of the VBA examples we offer. (In the few exceptions where code belongs in another module, this is pointed out to you.)
Since a code module can accommodate any number of functions or macros, this one module will usually be sufficient. As your code collection grows, it can make sense to move related functions into separate modules. This allows you to improve the overview, but this is not technically necessary.
Maybe it will work with VBA
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)