Neo, I'm not sure what you need here. Please explain this in a more simple way, thanks.
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
The reason is when you change it in vb6, the word doc is already static from the previous call. You need to unload the .dot, change the email address and reload the .dot again. It will then contain the new address.
It works similar to a web page, once loaded, it becomes static. Have a look at these Daniweb pages for instance. If you do not refresh the page (reload it) it will still show the same information as when you opened it.:)
Makes sense?
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
I +would rather close the entire document in code as you would have after the user is done with it. Then load it again in code as you did in the first instance when it was opened. The time difference in closing and reloading is minimal, the user would hardly notice the reloading.
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
Neo, paste me all the code you have where the email gets changed, the document gets loaded, the mail gets changed. I'll have to work through all the code to see where your problem lies.
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
No problem. I'll post a solution a bit later, meetings and stuff AND I'm watching the cricket.:)
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
Of course. Almost done with your testing.
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
Have a look at this. This is however saving the changes in a text file, word will raise errors.
Private Sub Command2_Click()
Dim alltxt As String
Dim nbytes As Long
Open App.Path & "\mydoc.txt" For Binary As #1
nbytes = LOF(1)
alltxt = Space$(nbytes)
Get #1, 1, alltxt
Close #1
alltxt = "Andre@there.com"
Open App.Path & "\mydoc.txt" For Binary As #1
Put #1, 1, alltxt
Close #1
End Sub
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
Now I don't understand what you mean. Is this not what you were looking for, as per your previous code?
You want to change the email address from the one currently in the text file with the new one you have just created. Thats what I understand from all of this.
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350
No problem. Send the folder. We are here to solve other posters problems, so you will never become a nuisance.:)
The main thing is that we must find a solution. You have showed a lot of effort from your side, hence all the help from me. PM me once you have posted the folder.;)
AndreRet
Senior Poster
3,922 posts since Jan 2008
Reputation Points: 334
Solved Threads: 350