473,326 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Excel macro and VB.net 2003

JR
Hi,

I NEED a macro into a ,by code, generated excel file

I call the sub with the 1 line: the sub follows

-----------start code---------------------------

sMakeMacroCode(objWB, "Blad1", "Worksheet", "Activate", Chr(9) &
"ActiveSheet.EnableAutoFilter = True")

Sub sMakeMacroCode _

(ByVal wbBoek As Excel.Workbook, ByVal sModuleName As String, ByVal sObject
As String, ByVal sAction As String, ByVal sCode As String)

'Ex:sMakeMacroCode(objWB, "Blad1", "Worksheet", "Activate", Chr(9) &
"ActiveSheet.EnableAutoFilter = True")

Dim StartLine As Long, X As Byte

With wbBoek.VBProject.VBComponents.Item(sModuleName).Co deModule

'the next line wont work

StartLine = .CreateEventProc(sAction, sModuleName) + 1

'For X = 1 To 100 : Next

..InsertLines(StartLine, sCode)

End With

End Sub

-----------end code---------------------------

I get the error

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred in system.windows.forms.dll

Additional information: De gebeurtenisafhandeling is ongeldig(the eventproc
isn't correct)

Can someone help me


Nov 21 '05 #1
0 795

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steven Stewart | last post by:
I have a user who has been using Excel for a while to keep statistics and print reports. She finds using it cumbersome because of long formulas and a lot of copying and pasting. I have designed...
6
by: geronimo_me | last post by:
Hi, I am trying to run an Excel macro from an Access module, however when I run the code the macro runs but then I get an error in Access. The error is: Run-time error "440", Automation error. ...
17
by: Mansi | last post by:
I need to do some research on how to use excel automation from c#. Does anyone know of any good books related to this subject? Thanks. Mansi
2
by: cr113 | last post by:
I just upgraded from Office 2000 to Office 2003. My VB.NET Excel macro calls don't work any longer. Here is how I make my Excel macro call from VB.NET: Dim objExcel as Excel.Application ...
1
by: thanhhuy27 | last post by:
I wrote a macro in Excel 97 run well but cannot run in Excel 2003. Can you help me? What is the big difference btween Macro Office 97& 2003? I appriciate your help thanhhuy27@gmail.com
2
by: Senthil | last post by:
Hi All I need to create an Excel report and create a command button and have to run a macro on the click event that will print all the pages in the Excel workbook. I am able to create the report...
7
by: Holger Fitschen | last post by:
Hi to all, I want to use the Excel solver in a VB.Net project. The macro Sub Makro1Solver() Application.Run "Solver.xla!Auto_Open" SolverReset Worksheets(1).Select...
0
by: sandervanee | last post by:
Hello, I am trying to export several Access 2003 select queries to Excel 2003 using an Access macro. I'm using the macro command "TransferSpreadsheet" to export the queries. This going quit well,...
8
by: Briansmi1116 | last post by:
Hi all, I am using Access 2003 as well as Excel 2003. I have an Access database that has an output to Excel button I created. This outputs a form to an Excel file A. I then have Excel...
0
by: Taxman | last post by:
Windows XP, MS Office Excel 2003 If the tasks, I’m trying accomplish have been addressed previously (separately or in combination). Please, provide the links or keyword search to find them. I’ve...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.