I finally finished my word doc. But now I was told to create a PDF instead u.u
I tried this code: - Dim Word_App As Word.Application
-
Set Word_App = New Word.Application
-
-
'Create and fill the word document.
-
-
'Save the document as PDF
-
Word_App.ActiveDocument.ExportAsFixedFormat
-
OutputFileName:=Replace(strPath, ".rtf", "") & " - " &
-
vtCartas(iMarcaCartasIndividuais).strMatricula & ".pdf", _
-
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, _
-
OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, TO:=1, _
-
Item:=wdExportDocumentContent, IncludeDocProps:=True,
-
KeepIRM:=True, CreateBookmarks:=wdExportCreateNoBookmarks,
-
DocStructureTags:=True, BitmapMissingFonts:=True, _
-
UseISO19005_1:=False
But I'm getting this error: Object Variable or With Block variable not set 9 5375
I have to assume this code was not a direct copy and paste because you are missing line continuation characters. But after I put those in and change the path to one on my computer, the code runs just fine for me.
Make sure you didn't unset Word_App somewhere above that line.
The Strange thing is that if I try this code: - Word_App.ActiveDocument.SaveAs filename:=strPath & "\doc1.doc"
It works, it saves the document as a .doc
but when I try to convert it to PDF it gives me the error =\
Well, I don't know what else to try. It works fine for me after I fix the line continuation characters.
- '********************** WORD ****************************
-
Private Word_App As Word.Application
-
Private Word_Doc As Word.Document
-
Private Word_Rtf_Doc As Word.Document
-
Private Word_Table As Word.Table
-
Private Word_Range As Word.Range
-
Private objRow As Row
-
Private objCell As Cell
-
Private sCellText As String
-
Private Range As Range
-
Private strPath As String
-
Private iMarcaPaginas As Integer
-
Private iMarcaCartasIndividuais As Integer
-
Private strTempLogo As String
-
'***************** END OF WORD ***************************
-
-
-
Private Sub CreateDoc(strCarta As String)
-
On Error GoTo Trata_Erros
-
Dim i As Integer
-
Dim strDebito As String
-
Dim strValor As String
-
Dim strVlMulta As String
-
Dim strVlSubTotal As String
-
-
-
strVlMulta = format(vtcJurosMultas(iLinha).cTotalTx, "#,##0.#0")
-
strVlSubTotal = format(vtcJurosMultas(iLinha).cSubTotal, "#,##0.#0")
-
-
With ActiveDocument.Content.Find.Execute FindText:="
-
debito>", ReplaceWith:="" & strDebito, format:=True,
-
Replace:=wdReplaceAll.Execute FindText:="<valor>",
-
ReplaceWith:="" & strValor, format:=True,
-
Replace:=wdReplaceAll.Execute FindText:=" <jurosmulta>",
-
ReplaceWith:="" & strVlMulta, format:=True, Replace:=wdReplaceAll.Execute FindText:="<total>",
-
ReplaceWith:="" & strVlSubTotal, format:=True,
-
Replace:=wdReplaceAll.Execute FindText:="<totalf>",
-
ReplaceWith:="" & strVlSubTotal, format:=True,
-
Replace:=wdReplaceAll
-
End With
-
-
Word_App.ActiveDocument.ExportAsFixedFormat OutputFileName:=Replace(strPath & "\doc1.doc",
-
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False,
-
OptimizeFor:=wdExportOptimizeForPrint,Range:=wdExportAllDocument, From:=1, TO:=1, _
-
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True,CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, BitmapMissingFonts:=True, _
-
UseISO19005_1:=False
Could you take a look and see if you find something wrong?
Thanks.
If this is a direct copy and paste of your code, then you are missing line continuation characters at 42 and 43.
I'm using the continuation characters... Just deleted by mistake... Guess I'll have to find antoher way to make this conversion ;\
In that case, if that's your entire code, Word_App is never initialized anywhere, it's only declared.
It's working now \o/ I had to install an Add-in of MS-Word. But now, the characteres are a little bit strange... It still letters and you're able to read it. But it's a little strange you know ? is there a way to fix it ?
I'm trying to find a way/command to renderize the font, but didn't find it yet.
Look:
We try to limit threads to one question each. Please create a new one for this question. As for the image, our firewalls block external storage sites, please upload the image to bytes instead.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ashutosh |
last post by:
How can i convert Word file to txt file in ASP.NET using CSharp?
|
by: Johnny |
last post by:
Hi,
I want to take a word document and convert it to a
postscript file in both a windows app or ASP.NET app.
I've read that someone have done this in this newsgroup,
but I have not been able to...
|
by: Dennis |
last post by:
Looking for a method to programmatically convert (using vB) a Word doc to it's ASCII equivalent. I understand I'll lose all formatting, and that's okay
Anyone out there have ideas
Thaks
...
|
by: Jeff Mason |
last post by:
Hi,
I am looking for a software component that will allow me to convert a MS Word doc
file to PDF from within my application.
I'm using VB.NET and I'm currently doing the conversion...
|
by: Jeff Mason |
last post by:
Hi,
I am looking for a software component that will allow me to convert a MS Word doc
file to PDF from within my application.
I'm using VB.NET and I'm currently doing the conversion...
|
by: Chris Davoli |
last post by:
I've got a requirement to build a page using MS WORD and then have the page
show up on a web site. I know I can do a binary write and open up the WORD
document in IE plugin. Don't really want to do...
|
by: kbperry |
last post by:
Hi all,
Background:
I need some help. I am trying to streamline a process for one of our
technical writers. He is using Perforce (version control system), and
is constantly changing his word...
|
by: chandu |
last post by:
Hello,
i need to convert a word doc into xml format and need to store that xml doc
in to a sqlserver database..
how to convert a word doc to xml and after retrieving that xml doc from
database...
|
by: digbydog |
last post by:
Hello,
I have been looking at trying to find a third party product to convert a
word document to a pdf is ASP DotNet. We previously did this in non web
environnment using acrobat distiller but I...
|
by: mzmishra |
last post by:
Hi,
I have one application in c# .net 1.1.
I like to convert word to pdf using Adobe Distiller .
Can any body help me get some code samples in C# for the same?
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |