OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 22-01-2009, 15:12
bprice's Avatar
bprice bprice is offline
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89
Default check for modification

hi everyone,
if i wanted to check to see if a file has been modified or saved in any way (at close time) how would I do this... or can it be done?

For example... if i open a file... do nothing and close it.. nothing happens! But if i open the file, modify it... and then save it... when I close the file I want a script to run because the file had been modified or saved since it was opened!

is this possible? I've used ActiveDocument.Dirty to flag a file for save... and I've been able to check if the file has been saved by using "If ActiveDocument.Dirty = True then....." but I'm not sure how to make it check if it has EVER been "Dirty" since it's been opened.

Any suggestions?

As always... thanks in advance!

Reply With Quote
Old 24-01-2009, 21:26
shelbym's Avatar
shelbym shelbym is offline
Senior Member
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,790
Blog Entries: 13
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Lets try this...

This might work, just the first thought off the top of my head. Use the DocumentBeforeSave Event to check if the file is dirty, if so save a document property. Then on the DocumentClose check your custom property to see if the file has ever been dirty. You will also want to clear this property on the opening of each document. Here is the code.
Private Sub GlobalMacroStorage_DocumentBeforeSave(ByVal Doc As Document, ByVal SaveAs As Boolean, ByVal FileName As String)
    If Doc.Dirty = True Then
        Doc.Properties(Modified, 1) = Doc.Dirty
    End If
End Sub

Private Sub GlobalMacroStorage_DocumentClose(ByVal Doc As Document)
    If Doc.Properties(Modified, 1) = "True" Then
        'Run your code
    End If
End Sub

Private Sub GlobalMacroStorage_DocumentOpen(ByVal Doc As Document, ByVal FileName As String)
    Doc.Properties(Modified, 1) = ""
End Sub
Let me know if that does what you need.

Reply With Quote
Old 27-01-2009, 09:36
bprice's Avatar
bprice bprice is offline
Join Date: Oct 2006
Location: Edmundston, New Brunswick, Canada
Posts: 89

as always my friend... you are the best!
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
group check bprice CorelDRAW/Corel DESIGNER VBA 6 16-12-2008 18:30
Folder Check norbert_ds CorelDRAW/Corel DESIGNER VBA 2 13-01-2008 21:18
Please someone check this! knowbodynow CorelDRAW/Corel DESIGNER VBA 9 31-03-2006 19:46
ExtSearch modification to multiple select adirx CorelDRAW CS 0 23-12-2005 18:06
How to check presence effects? G-Kir CorelDRAW/Corel DESIGNER VBA 3 22-06-2005 07:11

All times are GMT -5. The time now is 11:33.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com