A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Visio
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Help on previous posting



 
 
Thread Tools Display Modes
  #1  
Old November 13th, 2008, 12:58 PM posted to microsoft.public.visio.general
[email protected]
external usenet poster
 
Posts: 2
Default Help on previous posting

I originally posted this on Oct 9th and received no replies. Please
HELP!

I have a hydraulic/pneumatic schematic which I’ve animated using
several
macros via the double click method. I want to be able to create a list
of my
macros w/buttons in either Excel or Word that will run my macros when
clicked
on.

Is this even possible?

Thanks
Dave
  #3  
Old November 13th, 2008, 02:15 PM posted to microsoft.public.visio.general
Scott Helmers
external usenet poster
 
Posts: 8
Default Help on previous posting

I have done the opposite -- called Excel macros from Visio (using the code
below). Unfortunately, the Visio application object doesn't have a similar
run method but I thought I'd post this here in case it gives you some ideas.
= = = = = = = = = = = = = =
Sub CallMacroInExcel()
' opens Excel workbook (workbook_open macro, if any, will run)
' then calls specific macros contained in the workbook
'
' Add Reference to Excel to this VBA project before running macro

Dim xlApp As Excel.Application
Dim xlBook As New Excel.Workbook
Dim xlDocPath As String

xlDocPath = "c:\Temp\Excel book with macro.xls"

'Use existing Excel object or create a new one
On Error Resume Next
Set xlApp = GetObject(, "Excel.Application") ' get ref if already running
If Err = 429 Then
Set xlApp = CreateObject("Excel.Application")
End If

'Bring Excel to front
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Open(xlDocPath)

'workbook name must be surrounded by single quotes
xlApp.Run "'" & xlBook.Name & "'!RegularMacro"
'run macro in ThisWorkbook module
xlApp.Run "'" & xlBook.Name & "'!ThisWorkbook.RegularMacro"

End Sub
= = = = = = = = = = = = = =

" wrote:

I originally posted this on Oct 9th and received no replies. Please
HELP!

I have a hydraulic/pneumatic schematic which I’ve animated using
several
macros via the double click method. I want to be able to create a list
of my
macros w/buttons in either Excel or Word that will run my macros when
clicked
on.

Is this even possible?

Thanks
Dave

  #4  
Old November 13th, 2008, 04:22 PM posted to microsoft.public.visio.general
[email protected]
external usenet poster
 
Posts: 2
Default Help on previous posting

Can I create a list, menu, buttons or icons of macros within Visio
that can be viewed and executed from a separate window(monitor)?
  #5  
Old November 13th, 2008, 08:24 PM posted to microsoft.public.visio.general
Scott Helmers
external usenet poster
 
Posts: 8
Default Help on previous posting

Yes. The RUNMACRO function in the shapesheet can call a macro in the same or
a different document. Place one of the following in the DblClick event cell
or any other cell:
1) =RUNMACRO("DoStuff")
2) =RUNMACRO("ThisDocument.DoStuff")
3) =RUNMACRO("DoStuff","MyProjectName")
4) =RUNMACRO("ThisDocument.DoStuff","MyProjectName")

1 and 2 call a macro in the same document (#2 is used when the macro is in
the ThisDocument module).

3 and 4 do the same thing but when the macro is located in a VB project in
another document. NOTE: the other document must be open.

I'm sure there's way to do this in code but don't know what it is off the
top of my head. For a quick a dirty workaround, place the RUNMACRO shapesheet
formula in the EventXFMod cell of a shape then have your code "nudge" the
shape to fire the event by selecting the shape then using
ActiveWindow.Selection.Move 0.0001, 0#

If you want to restore the shape to its orginal position afterwards:
ActiveWindow.Selection.Move -0.0001, 0#

Remember that RUNMACRO will only work if the doc containing the macro is
open so your code may need to open it first.

Anyone have a cleaner solution?



" wrote:

Can I create a list, menu, buttons or icons of macros within Visio
that can be viewed and executed from a separate window(monitor)?

  #6  
Old November 14th, 2008, 04:16 PM posted to microsoft.public.visio.general
John... Visio MVP
external usenet poster
 
Posts: 900
Default Help on previous posting

"Paul Herber" wrote in message
ell.net...
On Thu, 13 Nov 2008 04:58:59 -0800 (PST), wrote:

I originally posted this on Oct 9th and received no replies. Please
HELP!

I have a hydraulic/pneumatic schematic which I've animated using
several
macros via the double click method. I want to be able to create a list
of my
macros w/buttons in either Excel or Word that will run my macros when
clicked
on.

Is this even possible?


I don't think it is, Dave.
Macros are not visible outside of the document containing them. (As
far as I know).


--
Regards, Paul Herber, Sandrila Ltd.
Electrical for Visio
http://www.electrical.sandrila.co.uk/



The trick is that you have to open an instance of Visio, fully qualify the
references and open the Visio stencil from Excel.

Most of the time I am sending information from Visio to Word or to Excel.

John... Visio MVP

  #7  
Old November 14th, 2008, 05:10 PM posted to microsoft.public.visio.general
Scott Helmers
external usenet poster
 
Posts: 8
Default Help on previous posting

Come to think of it, if you prepare the Visio shapes with the RUNMACRO
function as I suggested in my previous post, there's no reason why you
couldn't "nudge" them Excel or elsewhere. That would allow you to have your
buttons or list in Excel or Word.

" wrote:

Can I create a list, menu, buttons or icons of macros within Visio
that can be viewed and executed from a separate window(monitor)?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:11 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.