Running an Excel Macro from an Access Command Button

Hi ,

Can anyone help me with this, I am trying to run an excel macro from an 
access command button.
I want the macro to Bold the Headings on a excel spreadsheet.
The code runs without any errors but the macro doesnt seem to work, I think 
I have got the line
ExcelApp.ExecuteExcel4Macro "RUN(""PERSONAL.XLS!BoldHead"")"   wrong

The code:

Private Sub cmdRunMac_Click()

Dim ExcelApp As Excel.Application
Dim ExcelBook As Excel.Workbook

Set ExcelApp = Excel.Application
ExcelApp.Visible = True
Set ExcelBook = ExcelApp.Workbooks.Open("C:\Documents and 
Settings\emilie.vieville\Desktop\head.xls")

ExcelApp.ExecuteExcel4Macro "RUN(""PERSONAL.XLS!BoldHead"")"

ExcelBook.Save

ExcelApp.Quit
Set ExcelBook = Nothing
Set ExcelApp = Nothing


End Sub

Any help would be greatly appreciated

Thanks,
David K 


0
David
7/5/2007 9:37:11 AM
access.formscoding 7493 articles. 0 followers. Follow

0 Replies
934 Views

Similar Articles

[PageSpeed] 42

Reply:

Similar Artilces:

How do I use a "subtract" function in Excel?
Hi Kelly if you want to subtract the value in B1 from the value in A1 and have the answer display in C1 then in C1 type =A1-B1 Hope this helps Cheers JulieD "Kelly" <Kelly@discussions.microsoft.com> wrote in message news:5DF4C83F-6BF1-40A8-BC8A-692058A5C70B@microsoft.com... > ...

Conditional formatting macro
Help. I would like to know if it is possible to have a macro that changes the colour of a cell dependant on the number or text within. eg If the following cells were populated as follows a1=1 Make the cell Green =2 Make the cell Red =3 Make the cell Blue =4 Make the cell Orange and so on till 7 Is this at all possible ? I know that i can colour cells 3 times with simple conditional formatting, but would like to run upto seven different colours. any help would be appreciated. Steve '----------------------------------------------------------------- Private Sub Worksh...

Customized Toolbar RestoreState() fails if it has only 1 button
This issue happens only when the numbers of buttons in the tool bar is "1". Thats is, the user launches the customize toolbar dialog and removes all but 1 tool bar button. I have multiple Tool bars which I persist on application close and restore on application load. The SaveState() works fine as I notice the value "55 81 00 00" saved if only 1 button is left in the Tool bar. Here is the code for the RestoreState for (int i = 0; i < m_ToolBars.GetSize(); i++) { HKEY hSecKey = AfxGetApp()->GetSectionKey("Tool Bars"); if (hSecKey == NULL) break; CS...

Excel 2007
When I select cells to copy as a picture in Excel 2007, the resolution is terrible. Text and objects with shadow's are very blotchy when pasting the picture. How do you change the resolution of a 'Copy Picture'? ...

Input Excel 'Password to Open' through control in access form
Hi All, We know,Excel has prompt password to open it files. Is it possible to create a code that can supplies the excel prompt password?.So that when we open the excel file through our access control in a form, the excel files can be opened automatically.But when the excel files opened from its default icon,it will prompt a password first. ...

Excel not Access
I have designed an Access database that holds records relating to my stores audit results going back for about 5 years plus a load more information relating to these stores. This was used to produe a pack once a month, however a change in senior management means that I have got to shelve this and prodce a similar pack in Excel. The idea would be that the user could select a month or a 12 mnth date range that would produce data that could then be used to populate a number of excel templates that have been designed. Having not used excel for years I would be grateful for any suggestion...

How to keep format when importing Excel into SQL.
Can anybody help me please? When I import Excel file into SQL, a field that formated as 0000000000 (custom), loosing leading zeros. I tried to change data type in SQL after importing. No luck. I appretiate any help. See if using IMEX=1 helps: http://pratchev.blogspot.com/2007/10/importing-excel-data-into-sql-server.html -- Plamen Ratchev http://www.SQLStudio.com Plamen, I tried this, but got an error: "The OLE DB provider "Microsoft.Jet.OLEDB.4.0" has not been registered." Thank you very much for looking into this. "Plamen Ratchev" wr...

Auto-format in Microsoft Excel.
Each time i try to enter a number range, for example, 8- 10, in Excel, it constantly re-formats it to a date. If I change the formatting to "General" it turns it into a random number, usually 38209. I would like to turn off ALL auto-formatting, but that's probably asking too much. How do I disable this frustrating feature? thanks. Hi Paul When you enter "8-10" in a cell, that's not strictly a number but Excel thinks you mean a date so converts it as such. A date is a number and in your example the number 38209 represents August 10 2004 which is not a ra...

Running average
Hi Guys, Been struggling a bit on this so a pointer would be great. Just a simple example would do.. tableA with two fields "Startdate" and "Amount" now i need a running average in the query which would give me the following output: [Startdate] - [amount] - [average] 1-1-2010 - 100 - 100 2-1-2010 - 50 - 75 3-1-2010 - 60 - 70 So in the average column the last value should be the average of the sum of the previous records and the current records (being the average of the total). I know that the fieldnames are...

How to change font size on formula bar in Excell 2007
I don't find Tools>Options>General (as suggested in other post answers) in Excel 2007. On the Office button there is an Excel Options but it doesn't provide a method of changing font size on the office but. My font is so small I can barely see it. Office button>ExcelOptions>Popular tab>in the "When creating new workbooks" section, choose font and font size -- Kind regards, Niek Otten Microsoft MVP - Excel "jimwillie" <jimwillie@discussions.microsoft.com> wrote in message news:588AAC05-0F52-404E-AA01-128E70E02D0B@microso...

Opening Excel Workbooks
I'm running into an issue where if I click on an Excel file through My Documents, it doesn't automatically bring it up. I get the toolbar but the actual spreadsheet doesn't appear on the screen. I have to click on the taskbar to get it to pop up. If I already have Excel active and I open a file through Excel, this doesn't happen. Any ideas? Here is a similar thread: http://www.excelforum.com/showthread.php?s=&threadid=237195 Rolli -- Message posted from http://www.ExcelForum.com Hi, Take a look at Tools-Options-General tab- uncheck ignore other application...

Radar chart in Access 2007 report
Can you add a Radar chart to an access 2207 report? ...

Strange Access Denied Problem with Windows 7
I got a new computer about six months ago that came with Windows Vista Home Premium 64bit. Before that I had done all of my .NET development either on an XP Pro VM or my former XP Pro computer at home. Shortly after getting my new computer at home, I also got a license for VMWare to be able to test my software on multiple platforms and configurations. I had wrote an application originally in VB.NET that was a simple backup utility. It supports mutiple backup configurations. Any given copnfiguration would define a backup which would be a list of files to backup, a list of folders to ...

Unexpected error message on closing an Excel file
Suddenly I am getting the following message when I try to close a workbook: "Your formula contains an invalid external reference to a worksheet. Verify that the path, workbook, and range name or cell reference are correct, and try again" The mysterious thing is that it does not happen consistently and that, after I click OK after the above message, I can still save the file. What might be the cause of this error message and can the "invalid reference" be tracked down using one of the utility add-ins such as J. Walkenbach's PUP? If it only happens when you close ...

help with simple maths in excel
I want to do a simple arithmatic excercise in excel for my grand daughter. It is stuff like 2+2 =4 Smart me has hit a problem at the first hurdle... I need to put 2 in one cell the + in another cell and then 2 in another = in another and then she puts the answer in the next one. So the above would have 4 cells completed and she would put the answer in the 5th one. When I use the + or = sign in a cell of its own it (excel) thinks I am doing an equation, is there a way around this? I will work on the answer like if she gets it correct or wrong how I will do that...a sound or som...

Personal Macro Workbook
I had some macro stored in the personal macro workbook but now I can not find the workbook. When I try to do a new macro and store it in the "Personal Macro Workbook" I get the error message "Personal Macro Workbook in the startup folder must stay open for recording". I click ok and get a message that I'm unable to record. I can record macro to other workbooks. What happened to the personal macro workbook ? Thanks ...

How To Copy MS Word mailing labels into Excel
I have a word doc that I want to put into Excel. I want to add some more fields to the names and addresses. Is this simple or do I have to learn how to program? Michael Rodriguez City of Grand Prairie Michael, have you tried to copy and paste the data into excel? -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2000 & 97 ** remove news from my email address to reply by email ** "Michael Rodriguez" <mrodrigu@gptx.org> wrote in messa...

How do I use traffic lights in excel
I am wanting to use traffic lights in excel that change colour based on the result of a variance cell, ie if the result of the cell is 10 make the traffic light green, if it is 20 make the traffic light amber, if the result is 30 make the traffic light red. How do I do this? Shorty Format>Conditional Formatting>Cell Value is: Note: you can add up to 3 conditions(4 if you count default) Gord Dibben Excel MVP On Wed, 22 Dec 2004 16:35:03 -0800, Shorty <Shorty@discussions.microsoft.com> wrote: >I am wanting to use traffic lights in excel that change colour based on the &g...

keyboard shortcut in addin macro
How do you assign a keyboard shortcut or a custom button to run a macro which is in an addin. These macros dont appear on the macro list Thanks -- Patrick Hi have a look at the OnKey method in the VBA help -- Regards Frank Kabel Frankfurt, Germany "Patrick" <Patrick@discussions.microsoft.com> schrieb im Newsbeitrag news:FBEB937C-C3FC-47BB-8E8A-EE0BBCB14DFB@microsoft.com... > How do you assign a keyboard shortcut or a custom button to run a macro which > is in an addin. > > These macros dont appear on the macro list > > Thanks > -- > Patrick Patr...

HELP! remote data not accessible msg
Hello, I have a use who is currently using a Bloomberg DDE add- in. Whenever he attempts to activate the add-in to retreive remote data, the system hangs. If I go to task manager, I then see a message stating "Remote data not accessible. To access this data Excel needs to open another program.... I have searched the knowledge base and didn't find much help. Does anyone have any ideas? I am desperate!!!! We are currently using Excel 2003 in XP Professional. TIA, Ramissah ...

McAfee 8.5.0i on access scan slows down MS Dynamics CRM web client
Our organization's McAfee 8.50i slows down MS Dynamics CRM v4 - on premise web client considerabley when loading forms and data. Besides completely disabling McAfee, does anyone know how to configure McAfee (or configure CRM) to ignore CRM related form and data loads. When disabling the oncaccess scan, or when disabling the scriptcan - it improves lookups from 8-9 seconds to 4-5 seconds. However, the organizatin policy is to have these enabled. What to do? We have the same behavior, and went we reported to Microsoft says that no solution has, then we buy and install Microsoft Securi...

[b]Can I download Excel data to a MS Access database?[/b]
I've built an Excel 2002 form that I want our internal customers to access from our intranet, and use. Once completed, they will send it to us as an e-mail attachment. I'd like to be able to open it, and somehow download the data from the form into an MS Access 2002 database I've built (so that we don't have to rekey it into the database). Is this possible or even feasible? Any and all help is appreciated. Thanks. :D --------- Message sent via www.excelforums.com Hi in Access check 'File - Import External data' -- Regards Frank Kabel Frankfurt, Germany "...

Excel Problem
I have a 23.8 meg excel 2000 spreadsheet set for manual calculation saved to my local hard drive. Every time I try to open it, it takes forver and sometimes never opens but I do not get any error messages, let me just tell you that I am running a P4, 1 GB memory, Office 2K with SP3, and nothing else running when I try to open it. As I said it is set for manual calculation, and it is cleared to not auto calculate when opening or closing. Any idea's as to why this is happening? -- Todd I don't know why you're having this problem but I would like to point something out for w...

Excel DNS query
Hello, Is there a way for an Excel function to query a DNS server? Thanks. Soundy Not that I know of, but you can turn on the macro recorder, use 'get external data' and tailor the resulting code into a user function of your own. E.g. I've used this to create a button to get MS-Access data from a query that has the same name as the sheet (tab) name. It saves me a lot of copy-paste actions. Bas Hartkamp <soundy@gmail.com> schreef in bericht news:1151940450.029823.127570@j8g2000cwa.googlegroups.com... > Hello, > > Is there a way for an Excel function ...

Recording Macro Error Message
While recording the macro, I access the cell I need the formula in and write the formula. After writing the formula and hitting ENTER, I receive a microsoft GUI with "Unable To Record", and ackknowledge the GUI by hitting OK. The forluma is written to the cell - all even has the desired result/calculation. When I access the code, the navigation within the worksheet is listed in the code, but the furmula is not listed. I tried exiting the file and trying a second time, yet the same results. How do I "reset" the macro recorder to again begin to record all as...