Solved

Transfer Spreadsheet - call macro first

Posted on 2016-10-31
2
36 Views
Last Modified: 2016-10-31
Experts, I want to call an excel macro before transferring the spreadsheet.  How could I do this?

name of macro:  "Transpose"
Private Sub cmdImport_Click()

         Dim strName As String

            CurrentDb.Execute "delete * from [Import_FC]"
            strName = "Forecast"

   DoCmd.TransferSpreadsheet acImport, , "Import_FC", "C:\Users\johnsoat\Desktop\Import_FC.xlsm", True, strName & "!"

Open in new window



End Sub
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41866706
Hi,

pls try

Private Sub cmdImport_Click()

         Dim strName As String
         Dim xl As Object
            Set xl = CreateObject("Excel.Application")
            xl.Workbooks.Open ("C:\Users\johnsoat\Desktop\Import_FC.xlsm")
            xl.Run "MyMacro"
            xl.ActiveWorkbook.Close (True)
            xl.Quit
            Set xl = Nothing
            CurrentDb.Execute "delete * from [Import_FC]"
            strName = "Forecast"

   DoCmd.TransferSpreadsheet acImport, , "Import_FC", "C:\Users\johnsoat\Desktop\Import_FC.xlsm", True, strName & "!"

End Sub

Open in new window

Regards
0
 

Author Closing Comment

by:pdvsa
ID: 41866751
Perfect.  thank you!
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question