PC Review


Reply
Thread Tools Rate Thread

Dictator program question

 
 
xp
Guest
Posts: n/a
 
      10th Apr 2009
Hi,

I'm using Office 2007 on Windows XP; I have coded a dictator program that
incorporates similar code to the following (I say similar because I have
tweaked it somewhat and it is sort of complex to describe concisely here):

Private Function DicatorMode(argTrueFalse As Boolean)
'ExecuteExcel4Macro portion by Jim Rech; other code Nick hodge;
With Application
.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon""," & argTrueFalse & ")"
.CommandBars("Status Bar").Visible = argTrueFalse
If argTrueFalse = False Then .Caption = "User Mode" Else .Caption = ""
.ShowWindowsInTaskbar = argTrueFalse
End With
ActiveWindow.View = xlNormalView
ActiveWindow.WindowState = xlMaximized
End Function

The problem is, when this code runs, if the user opens a new XL file, in the
same instance, it is also in dictator mode, but then my shortcut menus are
unavailable, thus locking the user in a "stray" file with no way out.

Is there a way to alter the code to prevent this from happening?
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      11th Apr 2009
Try this in a workbook that should be in Dictator mode

Private Sub Workbook_Activate()
DicatorMode False
End Sub

Private Sub Workbook_Deactivate()
DicatorMode True
End Sub

If your code is in an addin use withevents at application or workbook level
to trap when a dictator wb is active or not.

FWIW the value of argTrueFalse does not seem intuitive in relation to the
name of the function, whatever.

Regards,
Peter T

"xp" <(E-Mail Removed)> wrote in message
news:F01BDBBD-ECFD-4D5E-8435-(E-Mail Removed)...
> Hi,
>
> I'm using Office 2007 on Windows XP; I have coded a dictator program that
> incorporates similar code to the following (I say similar because I have
> tweaked it somewhat and it is sort of complex to describe concisely here):
>
> Private Function DicatorMode(argTrueFalse As Boolean)
> 'ExecuteExcel4Macro portion by Jim Rech; other code Nick hodge;
> With Application
> .ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon""," & argTrueFalse & ")"
> .CommandBars("Status Bar").Visible = argTrueFalse
> If argTrueFalse = False Then .Caption = "User Mode" Else .Caption = ""
> .ShowWindowsInTaskbar = argTrueFalse
> End With
> ActiveWindow.View = xlNormalView
> ActiveWindow.WindowState = xlMaximized
> End Function
>
> The problem is, when this code runs, if the user opens a new XL file, in
> the
> same instance, it is also in dictator mode, but then my shortcut menus are
> unavailable, thus locking the user in a "stray" file with no way out.
>
> Is there a way to alter the code to prevent this from happening?



 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      12th Apr 2009
An alternative is to open the dictator in a new instance of Excel, and
prevent other workbooks from opening in this instance.

Prevent other workbooks from opening by setting the Ignore Other
Applications setting to True:
Application.IgnoreRemoteRequests = True

Open the dictator in its own instance: not so easy. There are a couple
different ways.
1. Have users double click a desktop shortcut (icon) to start it. Shortcut
runs a small VB6 exe that creates a new Excel object then loads the dictator
workbook. This has the benefit of bypassing the macro warning.
2. Routine in dictator's Workbook_Open code that detects whether other
windows are open and visible, and if so it opens a new instance and reopens
itself in that instance. I recall that there was a trick to this one, and
unfortunately I can't find the project now where I did this.

- Jon
-------
Jon Peltier, Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/>
Advanced Excel Conference - Training in Charting and Programming
http://peltiertech.com/Training/2009...00906ACNJ.html
_______


"Peter T" <peter_t@discussions> wrote in message
news:(E-Mail Removed)...
> Try this in a workbook that should be in Dictator mode
>
> Private Sub Workbook_Activate()
> DicatorMode False
> End Sub
>
> Private Sub Workbook_Deactivate()
> DicatorMode True
> End Sub
>
> If your code is in an addin use withevents at application or workbook
> level to trap when a dictator wb is active or not.
>
> FWIW the value of argTrueFalse does not seem intuitive in relation to the
> name of the function, whatever.
>
> Regards,
> Peter T
>
> "xp" <(E-Mail Removed)> wrote in message
> news:F01BDBBD-ECFD-4D5E-8435-(E-Mail Removed)...
>> Hi,
>>
>> I'm using Office 2007 on Windows XP; I have coded a dictator program that
>> incorporates similar code to the following (I say similar because I have
>> tweaked it somewhat and it is sort of complex to describe concisely
>> here):
>>
>> Private Function DicatorMode(argTrueFalse As Boolean)
>> 'ExecuteExcel4Macro portion by Jim Rech; other code Nick hodge;
>> With Application
>> .ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon""," & argTrueFalse & ")"
>> .CommandBars("Status Bar").Visible = argTrueFalse
>> If argTrueFalse = False Then .Caption = "User Mode" Else .Caption = ""
>> .ShowWindowsInTaskbar = argTrueFalse
>> End With
>> ActiveWindow.View = xlNormalView
>> ActiveWindow.WindowState = xlMaximized
>> End Function
>>
>> The problem is, when this code runs, if the user opens a new XL file, in
>> the
>> same instance, it is also in dictator mode, but then my shortcut menus
>> are
>> unavailable, thus locking the user in a "stray" file with no way out.
>>
>> Is there a way to alter the code to prevent this from happening?

>
>



 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      12th Apr 2009
"Jon Peltier" <(E-Mail Removed)> wrote in message

<snip>
> 2. Routine in dictator's Workbook_Open code that detects whether other
> windows are open and visible, and if so it opens a new instance and
> reopens itself in that instance. I recall that there was a trick to this
> one, and unfortunately I can't find the project now where I did this.


Not sure if there's any particular trick, simply re-open itself in a new
automated instance, then close itself in the current instance. It would end
up being read-only, which may or may not be a problem. I posted a quick
example here.

http://tinyurl.com/dxgzbb

Regards,
Peter T


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dictator Apps and Excel 2007 Greg Lovern Microsoft Excel Programming 1 17th Nov 2008 03:51 PM
Dictator App Gary Brown Microsoft Excel Misc 2 28th Oct 2008 04:49 PM
Making a [semi] Dictator Application: Hiding Main Command Bar? dim Microsoft Excel Misc 4 7th Jan 2008 11:38 PM
Making a [semi] Dictator Application: Hiding Main Command Bar? dim Microsoft Excel Programming 4 7th Jan 2008 11:34 PM
UK freebee site question (not a program related question) alpha Freeware 6 24th Apr 2005 11:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:07 AM.