Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2005

Tip: Looking for answers? Try searching our database.

document succesfully loaded

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
adi - 26 Dec 2005 21:42 GMT
how can i know when a document finished loading after openning?
(using c#)
Helmut Weber - 27 Dec 2005 22:13 GMT
Hi adi,

>how can i know when a document finished loading after openning?
>(using c#)

why do you want to know that?

Has it to do with code in an auto-macro?

A workaraound like the following might help,
for small documents.

Sub AutoExec()
'or autoopen or autonew or semething of that kind
Application.OnTime _
When:=Now + TimeValue("00:00:02"), _
   Name:="continue"
End Sub

sub continue
' whatever
end sub

Or maybe something like this, which works even for
a 1000 pages document:

Option Explicit
Dim p1 As Long
Dim p2 As Long
Sub autoopen()
Selection.EndKey unit:=wdStory
p1 = Selection.Information(wdActiveEndPageNumber)
continue
End Sub

Sub continue()
p2 = Selection.Information(wdActiveEndPageNumber)
If p1 = p2 Then
  MsgBox "ready"
  Else
  autoopen
End If
End Sub

Just to show a possible way, a workaraound.

With c#, you should be able to check wether
the process "WINWORD.EXE" is idle.
Helmut Weber - 27 Dec 2005 22:14 GMT
Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

adi - 28 Dec 2005 13:35 GMT
hi,
what i'm trying to do is run a tester that check files in different sizes in
order to get the loading time of documents with different sizes...
i created many files and i'm trying to run the tester on those files, open
each of them and get its time...

> Hi adi,
>
[quoted text clipped - 44 lines]
> With c#, you should be able to check wether
> the process "WINWORD.EXE" is idle.
Helmut Weber - 28 Dec 2005 14:16 GMT
Hi Adi,

how about this guess (!), that after repagination
has been finished a document has been fully loaded?

Option Explicit
Dim p1 As Long
Dim p2 As Long
Dim t As Long
Public Declare Function GetTickCount Lib "kernel32" () As Long
Sub autoopen()
t = GetTickCount
Selection.EndKey unit:=wdStory
p1 = Selection.Information(wdActiveEndPageNumber)
continue
End Sub

Sub continue()
Selection.EndKey unit:=wdStory
p2 = Selection.Information(wdActiveEndPageNumber)
If p1 = p2 Then
  MsgBox GetTickCount - t
  Else
  autoopen
End If
End Sub

HTH

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

adi - 28 Dec 2005 16:01 GMT
nice idea
i will try that
thanks! :)

> Hi Adi,
>
[quoted text clipped - 24 lines]
>
> HTH
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.