An Add-In.
Hmmmmm.... I hadn't thougth of that. I guess there *is* more than one way to skin the proverbial cat.
--
Matt W
There are 3 kinds of people:
Those who can count, and those who can't.
"Ed Jobe" wrote in message news:40bf70ec$1_1@newsprd01...
I would save it in an xla, addin file.
Start a new xls.
Add the macro to ThisWorkbook.
Save the file as an addin using the "Files of type" combo.
Save it to one of the XLSTART folders and it will auto load when xl starts and you won't need to add the code to every file.
--
----
Ed
----
"Matt W" wrote in message news:40bf694e$1_2@newsprd01...
Oh yeah... duh.
Well what do you expect... it wasn't even 8:30.
Sorry.
As for you Joe, here's what I would do:
1) Take the code that Ed wrote (modify it if need be) and put it into an
Excel workbook (this would be easier, in my opinion, than having AutoCAD
write the code to a module everytime).
2) Save that workbook as a template (*.XLT).
3) Have your ACAD VBA code open the template and write the block data to it.
4) Either save the workbook automatically or prompt the user for a location
to save it.
My 2 cents.
--
Matt W
There are 3 kinds of people:
Those who can count, and those who can't.
"R. Robert Bell" wrote in message
news:40bf3432_3@newsprd01...
| That's what Ed shows.
|
| 'add this function to __xl__ [emphasis mine]
| Function PassMsg(sPrompt As String, _
|
|
| ;^)
|
| --
| R. Robert Bell
|
|
| "Matt W" wrote in message
| news:40bf1845_2@newsprd01...
| Hi Ed
| I tried your code but... it displayed the msgbox inside of AutoCAD and
not
| in Excel. Here's what I used (after adding a reference to Excel).
|
| Option Explicit
|
| ' Application - Excel
| Public oExcel As Excel.Application
| Public oBook As Excel.Workbook
| Public oSheet As Excel.Worksheet
|
| Public Sub CreateExcel()
| Dim i As Integer
| Set oExcel = CreateObject("Excel.Application")
| Set oBook = oExcel.Workbooks.Add
| Set oSheet = oBook.Worksheets(1)
|
| oExcel.Visible = True
| End Sub
|
| Function PassMsg(sPrompt As String, _
| Optional cButtons As VbMsgBoxStyle, _
| Optional sTitle As String)
| MsgBox sPrompt, cButtons, sTitle
| End Function
| '
| 'run this from acad
| Sub test()
| CreateExcel
| 'first set xlApp an xl Application object
| oExcel.Run PassMsg("This is a test", vbCritical, "Testing")
| End Sub
|
| I think (if I understand Joe correctly, and maybe he can step in and
verify)
| what he wants is the msgbox to be shown in Excel.
| If that's the case, wouldn't the code for the msgbox need to reside
| somewhere within the workbook or a worksheet, then you can call that sub
| from AutoCAD, right?
|
| --
| Matt W
|
| There are 3 kinds of people:
| Those who can count, and those who can't.
|
| "Ed Jobe" wrote in message
| news:40be4081$1_2@newsprd01...
| Matt, you can. Create a wrapper function in xl and use the app's Run
| method.
|
| 'add this function to xl
| Function PassMsg(sPrompt As String, _
| Optional cButtons As VbMsgBoxStyle, _
| Optional sTitle As String)
| MsgBox sPrompt, cButtons, sTitle
| End Function
| '
| 'run this from acad
| Sub test()
| 'first set xlApp an xl Application object
| xlApp.Run PassMsg("This is a test", vbCritical, "Testing")
| End Sub
|
| --
| ----
| Ed
| ----
| "Matt W" wrote in message
| news:40be39fb_1@newsprd01...
| Given my experience with AutoCAD VBA and Excel, I don't think you can,
| but
| what you *can* do is have ACAD VBA display a msgbox, then switch focus
| to
| Excel.
|
| What exactly are you looking to do??
|
|
| --
| Matt W
|
| There are 3 kinds of people:
| Those who can count, and those who can't.
|
|
| "JoeMagas" wrote in message
| news:23683704.1086206811347.JavaMail.jive@jiveforum2.autodesk.com...
| | I would like an AutoCAD VBA program to display a MSGBOX in an opened
| session of excel, how can you do that?
| |
| | Joe
|
|
|