visual Basic and excel

srv656s

New Member
Joined
Feb 17, 2002
Messages
4
I posted something on this yesterday, and today the entire forum (Macro forum??) is gone... hmm.....

Well, someone had mentioned that to run an Excel macro from Visual basic I would have to create an 'object'? In visual basic. I was hoping someone could give me a little help on this or perhaps another way of running an excel macro from a visual basic program I'm writing.

Thank you very much for any help.

Shawn
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try something like this (hope it helps):

<pre><font color='#000000'>
<font color='#000080'>Sub</font> RunXLMacro()

<font color='#000080'>Dim</font> objXL <font color='#000080'>As</font> Excel.Application
<font color='#000080'>Dim</font> objWbk <font color='#000080'>As</font> Excel.Workbook

<font color='#000080'>Set</font> objXL = New Excel.Application

<font color='#000080'>Set</font> objWbk = objXL.Workbooks.Open("R:m-zRussellMiscExcelHelpArrayHelpAndMacroCallFromVB.xls")

objWbk.Application.Run "MacroNameHere"

objWbk.Close False
<font color='#000080'>Set</font> objWbk = Nothing

objXL.Quit
<font color='#000080'>Set</font> objXL = Nothing

<font color='#000080'>End</font> <font color='#000080'>Sub</font>

</font></pre>

-Russell
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,733
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top