|
I could really use some help with a problem I am having using Word Automation. Using ASP I have created an Online Reports Website were our Project Managers go and upload their status reports to the website itself. My boss wants me to combine the single reports into one big report as they are being uploaded to the site. The only way that I can figure out to do it is with Automation. I have never done it before or for that matter heard of it before. I have this so far.
set objWord = CreateObject("Word.Application")
set objAppendFileFSO = CreateObject("Scripting.FileSystemObject")
if objAppendFileFSO.FileExists(strAppendFileName) then
Set newReport = objWord.Documents.Add(strReadFile)
set completeReport = objWord.Documents.Add(strAppendFileName)
newReport.Selection.WholeStory()
newReport.Selection.Copy()
completeReport.Selection.PasteAndFormat(wdPasteDefault)
completeReport.InsertPagebreak()
completeReport.ActiveDocument.Close()
newReport.ActiveDocument.Close()
else
Set newReport = objWord.Documents.Add(strReadFile)
set completeReport = objWord.Documents.Add()
newReport.ActiveWindow.Selection.Range.WholeStory
newReport.ActiveWindow.Selection.Range.Copy
completeReport.Add.Content.Paste
'completeReport.ActiveWindow.Selection.PasteAndFormat(report)
completeReport.InsertPagebreak()
completeReport.SaveAs("D:\Inetpub\wwwroot\CJISReport\CJISreportPage\" & strYear & "\monthlyList\" & strmonth & "\MajorProjects\All Reports.doc")
completeReport.ActiveDocument.Close()
newReport.ActiveDocument.Close()
end if
The if is to determine if it was the first report of the month. It will create the new report if so. There is different code in them cause I have been trying different things with each of them and unfortuenetly none of them work. It just tells me this error: Permission Denied. It tells me this for the line "end if". I have no Idea what this means.
Any help would be really apprecieated.
Thank you in advanced.
Sokar
ctl - alt - del
if that dosen't work,
bang your head on the keybord.
|
|
|
|
|
sounds to me like the files are marked readonly (doubtful) or that you dotn have write permission on that folder. Check that out first and then let me know if that was the reason.
- Sage
|
|
|
|
|
I have full control over the folder(I am running locally on my computer). THe files are not read only files. I am pretty sure that It has something to do with the copy and past part. I have been playing around with the word macros in the VB editor and have had some ideas but nothing has born fruit as of yet.
btw, thank you for helping I do appriciate it.
Sokar
ctl - alt - del
if that dosen't work,
bang your head on the keybord.
|
|
|
|
|
I am looking at the API here (Word.10) and under Word.Document I see a Merge feature.
Sub Merge(FileName As String, [MergeTarget], [DetectFormatChanges], [UseFormattingFrom], [AddToRecentFiles])
Member of Word.Document
This looks hopeful .. I am going to mess with it here for a sec and see if this helps you because it sure sounds like the type of function you are trying to execute.
- Sage
|
|
|
|
|
sounds interesting I will look into it as well.
ctl - alt - del
if that dosen't work,
bang your head on the keybord.
|
|
|
|
|
this document here might help you out...
http://www.tek-tips.com/gviewthread.cfm/lev2/4/lev3/32/pid/708/qid/471051
|
|
|
|
|
here we go:::
strAppendFileName = "C:\MBrokers\Doc1.doc"
strReadFile = "C:\MBrokers\Doc2.doc"
Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Add()
WordApp.Selection.InsertFile strAppendFileName
WordApp.Selection.InsertFile strReadFile
WordDoc.SaveAs "C:\MBrokers\Doc1.doc"
WordDoc.Close
WordApp.Quit
Set WordDoc = Nothing
Set WordApp = Nothing
Response.write "<H3>Document Merged</h3>" & VbCrLF
BUT !!!!!
to make it work, I had to change IIS's security context to be administrator instead of IUSR_<MAchine Name>
but it works fine.....
|
|
|
|
|
This looks great thank you. One question though. I bealive I am running on admin already but Its telling me permission denied: CreateObject. Is that Why you had to switch to admin status? If so how can I check if its set that way? I feel stupid asking but I asked around here and I got a big I don't know, but the general consencus was that I was already at that satus.
Thanks again.
Sokar
ctl - alt - del
if that dosen't work,
bang your head on the keybord.
|
|
|
|
|
Hi
I have an asp.net web application. I want to deploy it. If i copy it to another computer's default web site, it works well. But if i copy it under to different web site, it does not work. What should i do?
thanks
|
|
|
|
|
I recommend moving your Q to the ASP.NET forum. Also when you do, post the details of the error message you are getting. We cannot help based on "it does not work".
regards,
Paul Watson
Bluegrass
South Africa
Miszou wrote:
I have read the entire internet. on how boring his day was.
Crikey! ain't life grand?
|
|
|
|
|
web.config and global.asax need to be in the root of the web site.
try moving those 2 files to the root of the website and see if that helps.
- Sage
|
|
|
|
|
I have a webpage that uses frames on it. I use a button on the bottom of the lower frame that goes back to the homepage. But when you click on the button, the frame on the top still stays there. I don't want the frame to stay there for certain links. Can anybody help me out there? Thank you.
<--Signature begins here-->
I am...
Currently: A Programming Student/Intern.
Working on an outside project: A game for the GamePark32 (GP32) portable gaming console.
GamePark32 English(Engrish) site[^]
My new website: www.gp32us.com *Currently Under Construction*
|
|
|
|
|
<a href="hyperlink" target="_top">
|
|
|
|
|
AH, thank you much.
<--Signature begins here-->
I am...
Currently: A Programming Student/Intern.
Working on an outside project: A game for the GamePark32 (GP32) portable gaming console.
GamePark32 English(Engrish) site[^]
My new website: www.gp32us.com *Currently Under Construction*
|
|
|
|
|
In Javascript, I can change the .innerText property of a hyperlink to adjust the visible text of said hyperlink in IE.
For Netscape, we seem to have a .text property which can be read but when I try to amend it, the whole thing falls over.
Does anyone have any idea how this can be done?
Paul
|
|
|
|
|
If you mean Netscape 6 and above then .innerText is supported. Below Netscape 6 (i.e. 4.x) good luck, hope you have lots of cows to sacrifice.
regards,
Paul Watson
Bluegrass
South Africa
Miszou wrote:
I have read the entire internet. on how boring his day was.
Crikey! ain't life grand?
|
|
|
|
|
Paul Watson wrote:
If you mean Netscape 6 and above then .innerText is supported.
Hmmm... it's not working for me in NS7.
Paul Watson wrote:
Below Netscape 6 (i.e. 4.x) good luck, hope you have lots of cows to sacrifice.
Thanks Paul, but "no" would have sufficed
Paul
|
|
|
|
|
My apologies, I should have said innerHTML , not innerText . I just tested that and it works.
Strangely innerText is valid, but it does not refresh the display in Netscape 7 or Firebird 0.6.1. Yet when I query the innerText it says it has been changed.
Anyway, innerHTML does work.
regards,
Paul Watson
Bluegrass
South Africa
Miszou wrote:
I have read the entire internet. on how boring his day was.
Crikey! ain't life grand?
|
|
|
|
|
Thanks Paul. I never cease to be amused how often I hear the word "Strangely" in conjunction with Netscape?
P
Paul
|
|
|
|
|
There are very many javascripts that do the same job (kinda like windows feature where you can expand a list by clicking on the link and collapse it by clicking on it again) but I am having a hard time recalling the simplest HTML way of doing it. It is one of the things you can do directly from FrontPage as well. Does anyone remember it? Please help!
PalMiss
|
|
|
|
|
It is always a JavaScript thing. FP must put in the JS for you. HTML has no support for collapsing/expanding lists.
regards,
Paul Watson
Bluegrass
South Africa
Miszou wrote:
I have read the entire internet. on how boring his day was.
Crikey! ain't life grand?
|
|
|
|
|
Hello,
I am working with 2 frames. One is a navigation frame, and the other is an edit frame. When the user clicks a link in the navigation frame, I would like the edit frame to display a message asking the user if they really want to redirect. The main purpose of this is to give the user a chance to go back to the current page and save any changes to the database before redirecting.
Thanks for your help,
RC
|
|
|
|
|
There is an event that is rised ...
I am not sure what it is. Its like onbeforeexit or something like that...
Have a look at MSDN...
Too busy to look it up now...
theJazzyBrain
Wise is he who asks good questions, not he who gives good answers
|
|
|
|
|
There is an "onbeforeunload" event which is raised before the page is unloaded. Specifically, it asks the user if they want to redirect or stay on the same page. This is exactly what I need. There is just one problem, it also fires when the page is posted back. So even when the user clicks the save button, the message to redirect or remain on the current page appears. Is there any way to get around that?
Thanks,
RC
|
|
|
|
|
You are correct, "onbeforeunload" is the one I was talking about...
chubbysilk wrote:
There is just one problem, it also fires when the page is posted back
Well, try and return true when it is posted back...
theJazzyBrain
Wise is he who asks good questions, not he who gives good answers
|
|
|
|