Problem with Macro Running When Closing a Document

Hi Folks;
I'm trying to develop a Visio macro that runs when I close a document, but I've run into a snag...
The problem is that the code below only works when I press the 'X' in the corner of the document to close it.  If I try to close it using
File -> Close, I get the error "Run Time Error -2032464741 (86db0c9b) An exception occurred", and the debugger highlights the first 'Application' line.
I need the code to work regardless of the close operation, and I'm not sure how to make that happen (since I assumed it should've work the same regardless).
Private Function Document_QueryCancelDocumentClose(ByVal doc As IVDocument) As Boolean
Document_QueryCancelDocumentClose = True
If MsgBox("If you made changes, did you UPDATE the Diagram History? (Select Yes if no changes were made)", vbYesNo + vbCritical + vbDefaultButton2, "Warning - DIAGRAM HISTORY UPDATED?") = vbYes Then
Application.ActiveDocument.Pages.ItemU("Diagram").Layers.Item("Warning").CellsC(4) = 1
Document_QueryCancelDocumentClose = False
Else
Document_QueryCancelDocumentClose = True
End If
End Function
Any help would be appreciated.
Zang

I'm betting your typical "try this" response is not what anyone wants.  But since you've chimed in... my problems with the Visio event model are PLENTY.  Print and save events that cannot be cancelled, document close that doesn't fire on application
close, and Application.BeforeDocumentSaveAs that occurs WAY AFTER the document has been saved are just a few.  (Did Microsoft even test these events??)  The official Microsoft response to ALL of this was, in a word, "repurpose" it. Essentially they
advocate completely rewriting the actual Save and Print portions of the interface and corresponding logic in Visio by intercepting keystrokes and redirecting ribbon extensibility idMso ="FileSave" and idMso ="FileSaveAs" commands to your own methods. 
To quote paid support:
"You may repurpose Save command in Visio as suggested in my previous email, however there is a design limitation that does not allow repurposing Print backstage button.
In order to achieve Visio Print repurpose, the workaround is to hide the print back stage altogether and plug with custom backstage ribbon xml."
We now also repurpose idMso="FilePrintQuick", idMso="FilePrintPreview", and idMso="FileClose" customUI commands, but we still had to use the logic above to catch save before closing. 
Valid methods that work while Visio is active will fail within Application close.  IT IS A BUG IN VISIO.  That is what this post is about.

Similar Messages

  • Problem with image location when converting word document to pdf

    Hello all,
    I am new to all this and this question may be already answered, but when I try to convert a word (2003-2007) document containing images (inserted photos) into a pdf document using Adober Reader 8, the images are moved from their original location and the size and ratio are changed.  Is there either a process for preserving the images as they are in the word doucment or a way to fix the problem?  Thanks for any help you can give.
    Regards,
    Rose

    Really not sure what you are trying to do since you can not import images into Reader. Since Reader can not create PDFs, we are at a loss of your problem. If you mean Acrobat, then tell us exactly the steps you are using to create the and what versions of both programs Like AA8.1., WORD 2003 (possibly release also) or WORD 2007. The different versions of WORD also also interact with Acrobat differently.

  • Problems with printer determination when printing material document

    Dear experts
    I have done config in transaction OMJ4 to have a material document printed when saving transfer posting (mvmt type 315) from MB1B.
    However, in OMJ4, printer 1 is defined....but the allocated printer for the material document is printer 2. I checked transaction OMJ3 and OMJ4, but printer 2 is not defined anywhere here.
    I try to run some kind of analysis in MB02 for my material document to get a clue on how the system picked up printer 2, but I do not see any analysis function for output det. in MB02.
    Anyone who would have a clue why printer 2 is picked instead of printer 1?
    I have checked user settings, all printers are set to LOCL.
    Any advice would be appreciated.
    Brgds,
    Lars

    Hi,
    As you set and assign printer in OMJ4.Now check Printer is defind in t.code: OMBR & then enable material doc printout in OMB5. Also cross check in t.code: OMJ3 for printer assigned to output type with combination of Plant & Storage location.
    Regards,
    Biju K

  • Problems with color matching when printing...

         Hi, I work for a small family business in the P.O.P. industry.  We currently have myself and one other designer, we both take illustrator files that have come from the graphic design firm that we contract with and get them ready to print on our Vutek QS3200.  However ever since acquiring the printer we have begun to run into problems with the colors when printing.  When the files are exported off of my computer, I use either .tif or .pdf files, they print as they should, the colors seem to match the proof and everything goes smoothly.  However when the other designer exports a file, he tends to do mainly pdfs, the colors tend to be extremely different from where we want them.  Also we will get very strange results, such as yesterday he kept getting a faint yellow 1/2" border around his prints.  After I believe 3+ hours of him trying, I was given the original CD and instructed to try.  After 15-20 minutes of making the changes that we needed to make (adding a new price point) and ripping, mine printed perfectly. 
         We both use Macs, both have CS3 Design standard, only differences between the computers are mine is newer and a bit faster, and I'm running OS 10.5.6 and he has 10.4.  He has also at some point loaded various color profiles, whereas my CS package is just whatever the default is when I loaded it.  When we were being trained he grabbed the color profile off of the Colorburst RIP server and loaded onto his computer, plus I believe he has a couple for freelancing purposes on there as well.  My thought is that these profiles are somehow corrupting the files that are going through that computer, but I honestly am lost with it at the moment.  He believes the problem lies within the fact that he does not have the newer OS, I honestly cannot see that as having any effect on this at all.  I was wondering if anyone has run into any similar problems, or if anyone might have any advice on this issue?  I would really like to be able to solve this, as I was hired to do mainly structural design for the P.O.P. and I'm having to put in a lot of overtime to get my work done along with the additional work that I'm having to do.
    Thanks for your time

    I've got a few years experience calibrating large format printers.  First, the Yellow sounds like a file problem.  I used to work with two workstations, one PC ( RIP station ), and one Mac ( file prep station ).  I tend to agree with you in that the OS is probably not the problem.  But, any Colorburst profiles should remain in the RIP, not in the originator application.  My workflow consisted of creating EPS files that were based on established color settings in their given applications ( i.e., Illustrator, Photoshop ) which were interpreted by the RIP which had it's own calibrated profile ( perhaps more than one based on how many different substrates were being used ).  Your partner may be complicating things by incorporating a RIP profile prematurely.  If there are deviations big enough to be noticed, there has to be something in the application color settings that is causing some type of corruption.  This could lead back to the operating system, but I would think it lies somewhere in Bridge or the application color settings.  Start there.  You should seriously consider implementing a calibration system if you do not have one already.  Another slight possibility is the driver's ability to interpret files coming out of Leopard vs. files coming out of Tiger.  It may benefit you both to be in the same operating system dynamics, using the same driver versions and RIP profiles.  At the very least, match everything that is currently working successfully and put them on both machines.  If there is still a noticeable problem in color matching, then something is seriously wrong and you should call in a prepress profiling expert.  Hope this helps.

  • I have a problem with the keyboar.when i push the key enter it doens't work

    i have a problem with the keyboar.when i push the key enter it doens't work

    Final Cut Express was discontinued about 18 months ago, before the release of Lion (10.7).  It is no longer a supported product and was never supported on Lion, nor on Mountain Lion.
    While some FCE users have had success running FCE on Lion, many have reported problems including problems with chroma keying.   I do not recall any solution to the chroma keying problem, but you might try searching this Forum to see what others have discovered or tried.
    Final Cut Pro X is the app supported on Lion & Mountain Lion, and the future direction Apple has taken.  Since your computer lab has already moved to Lion (10.7.5) and presumably will move to Mountain Lion in the future, you should begin the process of moving to Final Cut Pro X.  I appreciate there are implications for cost, training, inconvenience and re-doing lesson plans.  But technology moves on and at some point we need to move with it too.

  • What is the problem with IPhoto ´11 when I am uploading a photobook to apple store, there is always an error. Anyone ???

    What is the problem with IPhoto ´11 when I am uploading a photobook to apple store, there is always an error. Anyone ???
    evrything is right wite my appleID.

    First try to create a pdf file of the book as described in this Apple document: iPhoto '11: Preview a book, card, or calendar before you order or print it.
    If you are unsuccessful in creating the pdf file then boot into  Mac OS X: Starting up in Safe Mode and try again.  If that works you can continue and order the book while in Safe Mode. 
    Be sure to keep the pdf file of the book to compare with the printed copy when it arrives.
    OT

  • Problem with internet. When i open System preferences, Network, message drops down: 'your network settings have been changed by another application'. I click OK, but it drops a message again and again, preventing me to do anything about the setting.

    Problem with internet. When i open System preferences, Network, message drops down: 'your network settings have been changed by another application'. I click OK, but it dropps the message again and again, preventing me to do anything about the setting.

    A Fix for "Your network preferences have been changed by another application" Error 
    In the Library/Preferences/SystemConfiguration/ folder delete the following:
    com.apple.airport.preferences.plist
    NetworkInterfaces.plist
    preferences.plist
    com.apple.nat.plist
    You will have to re-configure all your network settings since deleting.
    (10.4.10)
    Use Software Update to update your OS to last version of Tiger.  Install all the other updates that goes along w/it.

  • I am suddenly having a problem with my iMac - when I try to restart or shut down, it hangs on a gray screen, and I have to hard reset to turn it off.  How do I fix this?

    I am suddenly having a problem with my iMac - when I try to restart or shut down, it hangs on a gray screen, and I have to hard reset to turn it off.  How do I fix this?

     
    http://support.apple.com/kb/TS2570 Mac OS X: Gray screen appears during startup 

  • Hi, i have a macbook air and i've been having problems with the camera when i'm using skype. i know im no the 1st one and i'd like to know when apple or someone 'll do something about this.

    hi, i have a macbook air and i've been having problems with the camera when i'm using skype. i know im no the 1st one and i'd like to know when apple or someone 'll do something about this.

    Try reinstalling Combo Update.
    http://support.apple.com/kb/DL1676
    Best.

  • I have a problem with my ipad when choosing software update it is continously loading the message checking for updates without showing any results

    I have a problem with my ipad when choosing software update it is continously loading the message checking for updates without showing any results  

    Hello SuzMiller
    Check out the article for the troubleshooting steps for issues with email on your iPhone and iPad.
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • Problems with colors running CS4 and W7.

    Hey everyone.
    I'm having some MASSIVE problems with colors on my system.
    Windows 7 Prof 64bit
    Photoshop CS4 64bit
    6g Ram
    1T hard drive
    Nvidia GeForce 9800 GTX+
    Dell SE198WFP Monitor 
    The system itself is a Dell Inspiron 530 that I put into a Black Widow V9 gaming tower. 
    Here is an example of the issue I'm having: 
    http://findae.deviantart.com/art/Converge-101214480
    http://i38.tinypic.com/bjcymr.jpg 
    The top image is a (admittedly old and crappy, but it shows the problem) photo that I had previously edited and put in my portfolio. The tinypic below is the result of copying that photo from the portfolio, pasting it into photoshop, and then saving it into a jpg. As you can see, the transitions between colors and the contrast are a complete mess. 
    Thing is, my hard drive recently quit on me, and I had to install the operating system and such on a new drive. I remember having this problem with the system when I first had it, but it either went away on its own or I fixed it somehow before. Now I can't remember for the life of me how I got rid of the problem, and I certainly don't know what the problem is in the first place. I'm tempted to think it may not be photoshop itself, but the problem seems to be especially bad when I'm working with photos. 
    Anyone have any idea what the problem might be and how to solve it? 
    Edit: I also noticed it when viewing http://findae.deviantart.com/gallery/#/d1hni37 in firefox, whereas the other photo appeared to be ok before I copied and pasted it. It has extremely obvious lines of green and orange in the transition from light skin tone to dark skin tone. Annoyingly enough, this doesn't show up in the thumbnail within my gallery at all, only when I click on the thumbnail and see the fullsize image. Extremely frustrating.  
    Here's another good look at the problem while selecting a color in photoshop: http://i37.tinypic.com/2h6t7gh.jpg  All I did was screenshot it a few times, and it deteriorated to that point.

    Screen glitches like color blocks appearing where they shouldn't could indicate a problem with your video drivers.
    Go to the nVidia site and see if they've released any updated drivers; people often report that updated drivers are correcting current problems with Photoshop.
    http://www.nvidia.com/object/win7-winvista-64bit-258.96-whql-driver.html
    Note the recent (3 weeks ago) release.
    -Noel

  • Good evening I would please help me, IGood evening I would please help me, I have problems with flash player when update on my computer Flash Player for windows 8, gives me error in the installation that is not apply on my computer. Please help. Thank You

    Good evening I would please help me, IGood evening I would please help me, I have problems with flash player when update on my computer Flash Player for windows 8, gives me error in the installation that is not apply on my computer. Please help. Thank You

    First, confirm that ActiveX Filtering is configured to allow Flash content:
    https://forums.adobe.com/thread/867968
    Internet Explorer 11 introduces a number of changes both to how the browser identifies itself to remote web servers, and to how it processes JavaScript intended to target behaviors specific to Internet Explorer. Unfortunately, this means that content on some sites will be broken until the content provider changes their site to conform to the new development approach required by modern versions of IE.
    You can try to work around these issues by using Compatibility View:
    http://windows.microsoft.com/en-us/internet-explorer/use-compatibility-view#ie=ie-11
    If that is too inconvenient, using Google Chrome may be a preferable alternative.

  • Is there a bug or problem with increased noise when exporting pictures out of Lightroom 4?

    Is there a bug or problem with increased noise when exporting pictures out of Lightroom 4?

    As you are asking about it, looks like you do see a problem. So if googling does not provide a solution, you should describe the issue in detail so we can try to help out.

  • Compatibility problem with macro media flash active control

    I am getting a message on my screen "compatibility problem with macro media flash active control, it isnt compatible with my version of windows (vista).  How can this be fixed?  why am I suddenly getting it now?  I have the latest Adobe flash player installed.
    Trisha

    the latest flash is probably the problem... it's seems that the latest flash has been causing a boat load of issues. i did a system restore to undo the flash and mozilla upgrades and it's still crashing but not as bad as it was with the upgrades.

  • Problem with a design when open in firefox like

    problem with a design when open in firefox like http://3a6aayer.com/Default.aspx

    What kind of problems do you have?
    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    Use a compressed image type like PNG or JPG to save the screenshot.

Maybe you are looking for

  • Huge amount of data in a view

    Hi All, I need to fetch data from a view. The size of the view is huge. If select statements are used, the time taken is large which results in  dump. Could anybody suggest me as to how I can extract data from this view? Regards, Pavan.

  • ESB performance issue: takes too long to select and insert records in DBs

    Hi, I have an ESB service which has to select data from seven different tables(using join operations) of one database and insert it into a single table of another database. It takes unduly long time to do this operation. For ex: it takes over 2 hours

  • Deployment Progress Monitor

    Once I start the application using "Debug" or "Run", the Deployment Progress Monitor will show the messages: "Starting Application" ... "asadmin -start-domain ...." and then this status window will be kept open even with "Automatically close" set. As

  • First Generation iPhone - can't seem to activate Bluetooth functionality

    I upgraded my first generation iPhone with V2.0 software, unfortunately I can't turn on Bluetooth functionality at all - can't even get to the point of trying to pair with a Motorola headset. I go to Settings>General>Bluetooth and move the switch fro

  • Hacking Session Variables??

    I have a php MySQL CRM site with plenty of sensitive information.. To protect this, I have a session based login system. Login page - checks password and assigns Username, UserGroup and Workgroup to session variables. Restricted pages - checks usergr