MS Access - VBA - OLE Object - vba

I saved some graphs as OLE Objects in one of my tables.
Now, I'm developing a word document using VBA from inside the MS Access; however, I do not know how to insert the OLE Objects saved in my table into the created word document.

Related

Excel VBA to run Access Macro---Linked Table issue

I have an Access query that creates a data table based on user defined parameters.
The data table is linked to excel, with a shared connection to Access.
I found some VBA code to run an Access macro from Excel, that basically reruns the query and updates the Access data table.
The issue i am having, is that I can't run the Excel VBA code with the Shared Connection, as it shows an error saying it is unable to delete the data in access, and therefore cannot complete the query.
The Excel VBA only works when the shared connection (linked Table) is removed.
How can I run an Access Macro from Excel using VBA, so that the access table is updated, and then the linked shared connection table in excel is refreshed and new data is shown?
Thanks!

Parsing Microsoft ODC file to connect to SQL Server database

I have an Excel workbook that I inherited and it refreshes data from an external data source. The connection string is:
DRIVER=SQL Server;SERVER=XXXXXX;UID=XXXXXX;Trusted_Connection=Yes;APP=Microsoft Office 2003;WSID=XXXXXX;DATABASE=XXXXXXXX;Network=XXXXXX
Can I use this information or the ODC file to connect to the database to query the table within?
Thanks.

OpenRowSet returning only one result

I am using OPENROWSET and Microsoft.ACE.OLEDB.12.0 to retrieve data in SSMS from an Excel 2007 (.xlsx) file. When I execute the query I only get the title of the first column (Excel cell A1) and F2, F3, etc. for the rest of the columns and no data within the table. The Excel file contains data; however, OPENROWSET is not retrieving anything other than cell A1.
I have tried both
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\filepath.xlsx','SELECT * FROM [Sheet1$]')
and
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\filepath.xlsx',[Sheet1$])
I get the same result for both queries.
I have also tried using the Import/Export Wizard (64-bit) and when I am on the 'Select Source Tables and Views' and use Edit Mappings... I receive the following error:
Column information for the source and destination data could not be retrieved
-Unexpected error from external database driver(1).
**Additional information**
->Unexpected error from external database driver (1).(Microsoft Access Database Engine)
I have a 64-bit version of SQL Server that is being used. Also, this is an Excel file that I receive from an outside source. The other Excel files I receive from outside sources do not give me any problems when retrieving data using the same method. Additionally, I am using SQL Server 2008 R2 and the Excel file is located on the same drive as the SQL Server.
Any help is greatly appreciated. It would be nice if I could get this working so I can handle moving the data from these files over to a SSIS package.

Load Data form one SQL table to Multiple Excel sheet in SQL 2005

How to load Data form one SQL table to Multiple Excel sheet in SQL 2005 through SSIS
Use BI studio to create a new project.
Create a new data flow task.
From the toolbox drag an OLE DB Source and an excel data flow destination you need.
Choose the OLE DB Source and drag the destination arrow to the excel destination.
Click each datasource and configure the details.
In the control flow you can copy the flow as many times you need and change to excel file destination to another file.

Generate word documents from excel file using mail merge

I am trying to generate word documents using the mail merge feature in Microsoft Word. To be as clear as possible my dream would be to:
(1) Place all values for all documents to be created in one excel document
(2) Use Word to create a template by selecting the above excel file as the data sheet
(3) Run a macro that would use the values from the excel sheet and perhaps the built in mail merge feature of Word to generate 1 file for each line in the excel sheet using one of the cells as the name of the file to be saved.
The end result would be the ability to create x number of Word documents using a template that pulls all the values from an excel sheet including the file name of the generated document.
Please help.
Thanks in advance.
You can do it by using Word and Excel Automation, using languages such as Visual Basic 6 (through COM), VB .Net (through interop) or C# (through interop), for example for getting data from a database. In your case because you simply want to create a documente based on excel data the simplest manner is to use the MS Word Mail's Merge Wizard.
Take a look at:
http://office.microsoft.com/en-us/excel-help/print-labels-by-using-excel-data-in-a-word-mail-merge-HP005203760.aspx