473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problems with SaveAs

Hi,

In word macro such thing worked perfectly:
With ActiveDocument
.SaveEncoding = msoEncodingUTF8
.SaveAs FileName:="c:\test.doc",
FileFormat:=wdFormatUnicodeText
End With

When I tried to use it in pure VB.net I put:

oWord = CreateObject("Word.Application")
With oWord.ActiveDocument
.SaveEncoding = msoEncodingUTF8
.SaveAs FileName:="c:\test.doc",
FileFormat:=wdFormatUnicodeText
End With

but all the time got an error in 'saveEncoding' line. I tried with
msoEncodingUTF8, with string "msoEncodingUTF8" and with
oWord.msoEncodingUTF8 but all the time got some errors (like {"Type
mismatch (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"}
How can I make it works??

Thank you, mark

Aug 24 '06 #1
2 5469
Hi Mark

I would say that the reason you're having problems is because in Word
you're setting the fileformat property to an Enum defined by word (and
therefore not recognised by VB). What you'd need to do is to establish
what the Enum equates to and use that in your VB code instead of the
Enum name.

Hope that helps
Martin
ma*******@gmail.com wrote:
Hi,

In word macro such thing worked perfectly:
With ActiveDocument
.SaveEncoding = msoEncodingUTF8
.SaveAs FileName:="c:\test.doc",
FileFormat:=wdFormatUnicodeText
End With

When I tried to use it in pure VB.net I put:

oWord = CreateObject("Word.Application")
With oWord.ActiveDocument
.SaveEncoding = msoEncodingUTF8
.SaveAs FileName:="c:\test.doc",
FileFormat:=wdFormatUnicodeText
End With

but all the time got an error in 'saveEncoding' line. I tried with
msoEncodingUTF8, with string "msoEncodingUTF8" and with
oWord.msoEncodingUTF8 but all the time got some errors (like {"Type
mismatch (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))"}
How can I make it works??

Thank you, mark
Aug 25 '06 #2
Hello,
I would say that the reason you're having problems is because in Word
you're setting the fileformat property to an Enum defined by word (and
therefore not recognised by VB).
Thank you for your answer :). Yes, that was the problem. Finally I
solved it.
If someone is interested in getting these values please feel free to
contact me priv.

Regards, mark

Aug 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: TOM | last post by:
I want to saveas silently ! it will not prompt to user for saveas please tell me how can I do this silently. please do replay ! OLEObject IE IE = CREATE OLEObject
3
by: lir | last post by:
Hi, I am trying to save a fram in a page using the execCommand("saveas") the html is save currectly but I can not save the gif on that page. How can I save the fram with the gif via...
1
by: Jeff | last post by:
I am using the HttpPostedFile to allow users to upload files to a server farm. The SaveAs() saves to a shared network path (\\SERVER\SHARE) so that no matter which web server is taking the...
5
by: Reddy | last post by:
System.Web.UI.HtmlControls.HtmlInputFile.SaveAs(FileName) is not overwriting the file. It used to work fine on IIS5.1 Recently we migrated to IIS6.0. Since then it's not working. If it's new file...
2
by: psanjay | last post by:
Hi, Am unable to open javascript SaveAs dialog box in Firefox browser. Following is the script, <a href="javascript:void(0);" onclick="document.execCommand('SaveAs',false,'*.xyz');">Save this...
5
by: =?Utf-8?B?U3R1YXJ0?= | last post by:
Hi There I have been having a play around with the following code to display a datagrid in Excel (all from Steve Orr's site): Private Sub btnTechServAccred_Click(ByVal sender As System.Object,...
0
by: Bitula | last post by:
Hi, I have a problem with powerpoints saveas during automation. I'm using ppt app to save several ppts to html and to gif. Despite using the app from separate threads (in MTA) looking at my log it...
3
by: =?Utf-8?B?Um9k?= | last post by:
The applicacion sends me the next message "Method not found: Excel._Worksheet.SaveAs (..." I thinks that its about permissions but I do not know how to fix it. I have the same source in two...
0
by: KUVU | last post by:
I am automating an excel report using C#.net.For this i am using a template (.xlt) my code is exceuting perfectly on localcomputer but when i tried on server(windows server 2003) it is not exceuting...
1
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...
0
isladogs
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.