tvtech
asked on
FanPages - Word Doc continued
Hi fp,
Situation has altered a little with this app. Is there a way to Save the currently open Doc file without having to reload it? I can find the filename easily enough to determine that the correct Doc is being saved. If Cust makes some changes, then hits 'Email this Doc', I need to make sure the open Doc is saved before processing it.
Thanks again.
TJ
Situation has altered a little with this app. Is there a way to Save the currently open Doc file without having to reload it? I can find the filename easily enough to determine that the correct Doc is being saved. If Cust makes some changes, then hits 'Email this Doc', I need to make sure the open Doc is saved before processing it.
Thanks again.
TJ
ASKER
Hi mgh_mgharish,
The question refers to the code at https://www.experts-exchange.com/questions/21673639/Populate-Doc-file-with-data-from-VB.html.
Wouldn't I need to re-open the Doc again, even though it's already open?
Thanks.
TJ
The question refers to the code at https://www.experts-exchange.com/questions/21673639/Populate-Doc-file-with-data-from-VB.html.
Wouldn't I need to re-open the Doc again, even though it's already open?
Thanks.
TJ
Oh.. sorry, yes. You can't update it without reopening the document after saving.
ASKER
500 points to anyone who can answer this question in a hurry.
Thanks.
TJ
Thanks.
TJ
ASKER
More information ...
I open a Doc file, using the following code and save it as another name. I need to be able to Save the current Doc file (Not the orignal) whenever I need to, even though the Doc will be open, as the User can make changes to the Doc whenever he/she likes.
The code I use to handle the code is as follows:
*************************
'/Code start
*************************
Dim objWord_Application As Object
Set objWord_Application = CreateObject("Word.Applica tion")
' Un-comment the next line to see the Word document creation on-screen, otherwise, to hide it, leave the next line alone...
objWord_Application.Visibl e = True
'/Open my template Doc
objWord_Application.Docume nts.Open ("C:\MyPath\MyDoc.Doc")
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Name/Description:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=CustName
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Address:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=Address
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Est Load:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=eLoad
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Estimated Commissioning Date:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=EstDate
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Plant Requirements:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=Plant
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Zone Substation:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=SubStation
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Upstream Isolator:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=UpIS
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Downstream Isolator:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=DownIS
objWord_Application.select ion.Find.C learFormat ting
objWord_Application.select ion.Find.T ext = "Feeder:"
objWord_Application.Select ion.Find.F orward = True ' *** ADDED
objWord_Application.Select ion.Find.W rap = 1& ' wdFindContinue *** ADDED
objWord_Application.select ion.Find.E xecute
objWord_Application.select ion.MoveRi ght Unit:=12& ' wdCell
objWord_Application.select ion.TypeTe xt Text:=Fdr
'/Scroll to top of Doc
objWord_Application.select ion.HomeKe y Unit:=6&
'/Save Doc as new filename, based on Custname and Address
objWord_Application.Active Document.S aveAs "C:\MyPath\MyNew.Doc"
'/Close original doc name that we opened to begin with
objWord_Application.Docume nts.Close "C:\MyPath\MyDoc.Doc"
'/Ensure active document is visible
objWord_Application.Active Document
'/Clear Doc object from memory
Set objWord_Application = Nothing
Any questions, let me know.
Regards,
TJ
I open a Doc file, using the following code and save it as another name. I need to be able to Save the current Doc file (Not the orignal) whenever I need to, even though the Doc will be open, as the User can make changes to the Doc whenever he/she likes.
The code I use to handle the code is as follows:
*************************
'/Code start
*************************
Dim objWord_Application As Object
Set objWord_Application = CreateObject("Word.Applica
' Un-comment the next line to see the Word document creation on-screen, otherwise, to hide it, leave the next line alone...
objWord_Application.Visibl
'/Open my template Doc
objWord_Application.Docume
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.select
objWord_Application.Select
objWord_Application.Select
objWord_Application.select
objWord_Application.select
objWord_Application.select
'/Scroll to top of Doc
objWord_Application.select
'/Save Doc as new filename, based on Custname and Address
objWord_Application.Active
'/Close original doc name that we opened to begin with
objWord_Application.Docume
'/Ensure active document is visible
objWord_Application.Active
'/Clear Doc object from memory
Set objWord_Application = Nothing
Any questions, let me know.
Regards,
TJ
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It's not clear what the problem is. Of course you can save an open document.
And there isn't any point in opening a document merely to save it.
And there isn't any point in opening a document merely to save it.
GrahamSkan, what he wants is to load the contents of a document to another document, for which the first document is to be stored, reopened and then its contents are to be used by other one.
ASKER
I've actually found my own solution to this question, so if we can just close the question, it would be appreciated.
Regards,
TJ
Regards,
TJ
Harish, Thanks for the explanation.
If you need two copies of a document, then doing SaveAs twice would seem the simplest thing to do.
However, I see that you now say that you have found your own solution.
If you want a points refund, you can request that with a question in the Community Support area. To be eligible, you would usually be expected to have provided an explanation here.
If you need two copies of a document, then doing SaveAs twice would seem the simplest thing to do.
However, I see that you now say that you have found your own solution.
If you want a points refund, you can request that with a question in the Community Support area. To be eligible, you would usually be expected to have provided an explanation here.
ASKER
Frankly, if no one has been able to answer the question and the person who asked it has found the answer themselves, I don't see why that person should be required to publish his solution to get a refund that no one actually deserved the points for. :-( The only reason I can see that requirement would be for the owners of E-E to make a buck when either selling CD's, or selling Premium accounts.
E-E is not so much about free info exchange, as it is about creating a money driven info exchange, which is fair enough, but giving up info for non-earned points (refund) is a bit wrong as far as I'm concerned.
bruintje, it's all yours. Too much hassle to go through the refund process.
TJ
E-E is not so much about free info exchange, as it is about creating a money driven info exchange, which is fair enough, but giving up info for non-earned points (refund) is a bit wrong as far as I'm concerned.
bruintje, it's all yours. Too much hassle to go through the refund process.
TJ
TJ, thanks even though i think it is a good solution this leaves open for a reader what you used to solve this one
so awarding the points for something that could be or could be not related to the solution is not ok, i'll post a cs q myself to refund your points
so awarding the points for something that could be or could be not related to the solution is not ok, i'll post a cs q myself to refund your points
ASKER
bruintje, I used part of your solution, so no, that would be unfair. Leave the points as they are.
Thanks.
Thanks.
ok :)
tvtech,
I suppose that the reason that questioners are expected to publish their solution in order to get a refund is that it is otherwise quite easy to take and use one of the offered solutions and simply make the claim that they have found their own answer.
I suppose that the reason that questioners are expected to publish their solution in order to get a refund is that it is otherwise quite easy to take and use one of the offered solutions and simply make the claim that they have found their own answer.
ASKER
GrahamSkan,
Yes, I thought of that as I was typing and would normally agree, but in most cases, the Moderator has the experience to look at the original question, check the answers and then make an informed decision as to whether any of the answers comes close to the solution requested. At any rate, in 8yrs of membership, I have never had a question gone unanswered until now, so, 1 out of 9 ain't bad. :-)
Thanks for your input.
TJ
Yes, I thought of that as I was typing and would normally agree, but in most cases, the Moderator has the experience to look at the original question, check the answers and then make an informed decision as to whether any of the answers comes close to the solution requested. At any rate, in 8yrs of membership, I have never had a question gone unanswered until now, so, 1 out of 9 ain't bad. :-)
Thanks for your input.
TJ
ThisDocument.Save
---
Harish