F
Fred Kruger
I would like to know if it is posible to determine if how word has been
started.
I have been tiraling running word across a network when it normally starts
it loads a global template which carries all the sub routines needed to do
various things built into forms that are produced.
However other programs also use word as as a front end for doucuments they
contain within them, but because when the load word it takes an long time
because it is loading all the routines etc from the globally loaded template.
So here is what I would like to do if posible.
if word is opened by one of these other programs other than by the icon word
doesnt load the template if however its not opened.
I have used the following to determine if open by the icon
Sub iconstart()
'
'checks to see how word has been launched
'
Dim strCommandLine As String
'get the commandline by calling the CmdLinetoString function, which
follows
strCommandLine = CmdLinetoString(GetCommandLine())
If Len(strCommandLine) <= Len(Chr(34) & Application.Path & _
"\" & "winword.exe" & Chr(34) & " ") Then
'Following only runs if Word was launched from its icon
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges 'closes
document without saving
End If
'End If
End Sub
Public Function CmdLinetoString(ByVal lngPtr As Long) As String
Dim strReturn As String
Dim StringLength As Long
'get the length of the string (not including the terminating null
character)
StringLength = lstrlen(lngPtr)
'initialize our string so it has enough characters including the null
character
strReturn = String$(StringLength + 1, 0)
'copy the string we have a pointer to into our new string
lstrcpy strReturn, lngPtr
'now strip off the null character at the end
strReturn = Left$(strReturn, StringLength)
'return the string
CmdLinetoString = strReturn
End Function
but is there a way of determining which program has opened word?????
I am using word 2003
Thanks in anticipation
started.
I have been tiraling running word across a network when it normally starts
it loads a global template which carries all the sub routines needed to do
various things built into forms that are produced.
However other programs also use word as as a front end for doucuments they
contain within them, but because when the load word it takes an long time
because it is loading all the routines etc from the globally loaded template.
So here is what I would like to do if posible.
if word is opened by one of these other programs other than by the icon word
doesnt load the template if however its not opened.
I have used the following to determine if open by the icon
Sub iconstart()
'
'checks to see how word has been launched
'
Dim strCommandLine As String
'get the commandline by calling the CmdLinetoString function, which
follows
strCommandLine = CmdLinetoString(GetCommandLine())
If Len(strCommandLine) <= Len(Chr(34) & Application.Path & _
"\" & "winword.exe" & Chr(34) & " ") Then
'Following only runs if Word was launched from its icon
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges 'closes
document without saving
End If
'End If
End Sub
Public Function CmdLinetoString(ByVal lngPtr As Long) As String
Dim strReturn As String
Dim StringLength As Long
'get the length of the string (not including the terminating null
character)
StringLength = lstrlen(lngPtr)
'initialize our string so it has enough characters including the null
character
strReturn = String$(StringLength + 1, 0)
'copy the string we have a pointer to into our new string
lstrcpy strReturn, lngPtr
'now strip off the null character at the end
strReturn = Left$(strReturn, StringLength)
'return the string
CmdLinetoString = strReturn
End Function
but is there a way of determining which program has opened word?????
I am using word 2003
Thanks in anticipation