Click here to Skip to main content
16,008,750 members
Home / Discussions / C#
   

C#

 
GeneralRe: making calculator Pin
Alomgir Miah22-Feb-06 19:37
Alomgir Miah22-Feb-06 19:37 
Questionsapi 5.1 and c# Pin
richiemac22-Feb-06 10:50
richiemac22-Feb-06 10:50 
QuestionSourceSafe Pin
AJ12322-Feb-06 10:09
AJ12322-Feb-06 10:09 
AnswerRe: SourceSafe Pin
Joe Woodbury22-Feb-06 11:06
professionalJoe Woodbury22-Feb-06 11:06 
QuestionDatabinding question Pin
Tom Wright22-Feb-06 9:59
Tom Wright22-Feb-06 9:59 
QuestionAutomation question Pin
Tom Wright22-Feb-06 9:49
Tom Wright22-Feb-06 9:49 
AnswerRe: Automation question Pin
Dave Kreskowiak22-Feb-06 16:17
mveDave Kreskowiak22-Feb-06 16:17 
GeneralRe: Automation question Pin
Tom Wright23-Feb-06 5:52
Tom Wright23-Feb-06 5:52 
here is my code.
First I open the doc:
<br />
		if (File.Exists(TemplatePath + "\\PO.dot"))<br />
		{<br />
			private object oMissing = System.Reflection.Missing.Value;<br />
			private Word.ApplicationClass oWord = new Word.ApplicationClass(); <br />
			private Word.Documents oDocs; <br />
			private Word._Document oDoc;<br />
<br />
			try<br />
			{<br />
				File.Copy(TemplatePath + "\\PO.dot", SaveToPath + "\\PO" + PONumber + ".doc");<br />
				oWord.Visible = true;<br />
				oWord.Activate();<br />
				object oFile = SaveToPath + "\\PO" + PONumber + ".doc";<br />
				oDocs = oWord.Documents;<br />
				bPOCreated = true;<br />
				try<br />
				{<br />
					oDoc = oDocs.Open(ref oFile, ref oMissing,<br />
						ref oMissing, ref oMissing, ref oMissing, ref oMissing,<br />
						ref oMissing, ref oMissing, ref oMissing, ref oMissing,<br />
						ref oMissing, ref oMissing, ref oMissing, ref oMissing,<br />
						ref oMissing, ref oMissing);<br />
				}<br />
				catch(Exception err)<br />
				{<br />
					oDoc = oDocs.OpenOld(ref oFile, ref oMissing,<br />
						ref oMissing, ref oMissing, ref oMissing, ref oMissing,<br />
						ref oMissing, ref oMissing, ref oMissing, ref oMissing);<br />
				}<br />
<br />


Then my close:
<br />
			try{<br />
				oDoc.Close(ref oMissing, ref oMissing, ref oMissing);<br />
				System.Runtime.InteropServices.Marshal.ReleaseComObject (oDoc);<br />
				oDoc = null;<br />
				System.Runtime.InteropServices.Marshal.ReleaseComObject (oDocs);<br />
				oDocs = null;<br />
				oWord.Quit(ref oMissing, ref oMissing, ref oMissing);<br />
				System.Runtime.InteropServices.Marshal.ReleaseComObject (oWord);<br />
				oWord = null;<br />
				bPOCreated = false;<br />
				GC.Collect();<br />
				Close();<br />
			}<br />
			catch(Exception err)<br />
			{<br />
				GC.Collect();<br />
				//Close();<br />
			}<br />
<br />


Tom Wright
tawright915@yahoo.com
Questionkey finder Pin
superPaul10122-Feb-06 9:09
superPaul10122-Feb-06 9:09 
AnswerRe: key finder Pin
Dave Kreskowiak22-Feb-06 16:15
mveDave Kreskowiak22-Feb-06 16:15 
QuestionProgrammatic IIS Adiministration Pin
Le centriste22-Feb-06 9:04
Le centriste22-Feb-06 9:04 
AnswerRe: Programmatic IIS Adiministration Pin
minhpc_bk22-Feb-06 14:39
minhpc_bk22-Feb-06 14:39 
QuestionRefreshing UI Pin
2hdass22-Feb-06 9:01
2hdass22-Feb-06 9:01 
AnswerRe: Refreshing UI Pin
Dave Kreskowiak22-Feb-06 16:13
mveDave Kreskowiak22-Feb-06 16:13 
QuestionInvalid Cast Pin
TheJudeDude22-Feb-06 8:55
TheJudeDude22-Feb-06 8:55 
AnswerRe: Invalid Cast Pin
Le centriste22-Feb-06 9:05
Le centriste22-Feb-06 9:05 
GeneralRe: Invalid Cast Pin
TheJudeDude22-Feb-06 9:35
TheJudeDude22-Feb-06 9:35 
GeneralRe: Invalid Cast Pin
Le centriste22-Feb-06 9:36
Le centriste22-Feb-06 9:36 
GeneralRe: Invalid Cast Pin
TheJudeDude22-Feb-06 10:59
TheJudeDude22-Feb-06 10:59 
GeneralRe: Invalid Cast Pin
Le centriste22-Feb-06 11:11
Le centriste22-Feb-06 11:11 
GeneralRe: Invalid Cast Pin
TheJudeDude22-Feb-06 12:38
TheJudeDude22-Feb-06 12:38 
Questionhow will i know if a process has exited Pin
batmanAgen22-Feb-06 8:55
batmanAgen22-Feb-06 8:55 
QuestionAudio volume level Pin
McBainUK22-Feb-06 8:46
McBainUK22-Feb-06 8:46 
AnswerRe: Audio volume level Pin
McBainUK22-Feb-06 8:59
McBainUK22-Feb-06 8:59 
Questionkeys event Pin
Kola Sokol22-Feb-06 7:39
Kola Sokol22-Feb-06 7:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.