Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: GS Newsgroups: comp.lang.basic.visual.misc Subject: Re: VB6 to Excel Date: Sun, 24 Apr 2011 12:28:17 -0400 Organization: A noiseless patient Spider Lines: 42 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 24 Apr 2011 16:25:16 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="UVJBuiIZprDyxzUkJsiwfw"; logging-data="11113"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JTGXM+CYa0gYa83CQKs1F" X-Antivirus-Status: Clean X-Newsreader: MesNews/1.08.03.00-gb X-Antivirus: avast! (VPS 110424-0, 04/24/2011), Outbound message Cancel-Lock: sha1:82czYtOzRDO4VxLt/M3nsxPD4lw= X-ICQ: 543516788 Xref: x330-a1.tempe.blueboxinc.net comp.lang.basic.visual.misc:96 It happens that Ivar formulated : > Thank you for your reply > .Select - That's the bit I was missing. Got it now > > After adding a reference to "Microsoft Visual basic for Applications > Extensibility" to the VB6 project I can now add a std Module to the Excel > Project files and add code to that. While you're at it you could predesign your worksheet[s] (formatting/formulas already in place) so all you need to do from VB6 is dump your data into the appropriate cells. > I would still rather put the code in the click event of the button tho. The type of button your using doesn't have a 'click event'. As Gord suggests, you assign a macro to it. This is done programmatically by specifying the macro when setting its "OnAction" property as shown in my code sample. To do this manually you can right-click the button and choose 'Assign macro' on the popup menu. If you prepare the Excel file beforehand you can have the controls in place with caption text, formatting, and macros assigned. (Requires the macros also exist, preferably in a standard module.) > > Using the Macro recorder is an easy way to get the VBA sintax, it's > unfortunate that you can't use the macro recorder to record that fact that > you are creating a macro. Oh well :-) Not sure what you mean here. Using the macro recorder to record a macro does (by attrition) do just that. Problem is the generated code almost always needs cleanup/refining editing. -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc