473,836 Members | 1,519 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Word Automation, picture sizing

I am having trouble sizing a picture after inserting it into Word using
VB.NET. I have a Windows form that allows a user to select several pictures
from file. They can then export those pictures to a Word document. I can
control the size of the picture on my form using a picture box, but how can I
size it in Word, using VB.NET, after I have inserted it? I want to force the
picture to a certain size. I tried using a template, but the picture was not
forced to the size of the image on the template. Below is what I have so far:

Dim oWord As Word.Applicatio n
Dim oDoc As Word.Document

'Start Word
oWord = New Word.Applicatio n()
oDoc = oWord.Documents .Add

oWord.Visible = True
oDoc.InlineShap es.AddPicture(f ileName:=pic1, _
LinkToFile:=Fal se, SaveWithDocumen t:=True)

This creates a word document with the picture in it, but the picture is much
bigger than I want. I want to be able to give the picture a specific size in
Word. Any ideas?
Nov 21 '05 #1
1 5729
I haven't tried it but I suggest something like:

Dim oPic as Word.InlineShap e
oPic = oDoc.InlineShap es.AddPicture(f ileName:=pic1, _
LinkToFile:=Fal se, SaveWithDocumen t:=True)
oPic.Height = 10
oPic.Width = 10

Good luck
Fred

"blue_nirva na" <bl*********@di scussions.micro soft.com> wrote in message
news:CE******** *************** ***********@mic rosoft.com...
I am having trouble sizing a picture after inserting it into Word using
VB.NET. I have a Windows form that allows a user to select several pictures from file. They can then export those pictures to a Word document. I can
control the size of the picture on my form using a picture box, but how can I size it in Word, using VB.NET, after I have inserted it? I want to force the picture to a certain size. I tried using a template, but the picture was not forced to the size of the image on the template. Below is what I have so far:
Dim oWord As Word.Applicatio n
Dim oDoc As Word.Document

'Start Word
oWord = New Word.Applicatio n()
oDoc = oWord.Documents .Add

oWord.Visible = True
oDoc.InlineShap es.AddPicture(f ileName:=pic1, _
LinkToFile:=Fal se, SaveWithDocumen t:=True)

This creates a word document with the picture in it, but the picture is much bigger than I want. I want to be able to give the picture a specific size in Word. Any ideas?

Nov 21 '05 #2

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

Similar topics

1
12091
by: mickeydisn | last post by:
Sub: C++ Word automation Extract text hello. I want extact text form a word document using a visual c++ programme. I have see a lot of documentation. and my analysis is that I must use a "word automation". I have foud a lot of exemple to use it but I need your precious help to
2
2617
by: kids | last post by:
Does anybody know any reason which could cause Ms. word automation to crash? I try to call word automation to open a document and use find and replace function. For some reason it works but I don't know why it crash some time.
4
7688
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to handle the automation. So, i'm using the following code to create a new word document: ---Code---
1
1315
by: Franck | last post by:
hello, I've found this tutorial for word automation in asp http://www.codeproject.com/aspnet/wordapplication.asp TO work I need to include the "Microsoft Word 10.0 Object Library dll" But i canot find it on my PC Has anyone found a place to donwload it?
4
2759
by: Charles Law | last post by:
Does anyone know which files need to be distributed with a VB.NET application to enable Word automation on a m/c that does not have Word installed? Is this even possible / permissible? I currently get the error "File or assembly name Microsoft.office.interop.word or one of its dependencies was not found". TIA Charles
2
3455
by: johnc | last post by:
Hi all Been struggling to get word automation working via ASP on the server. The COM objects etc are installed and there already exists an Excel automation application which works, done by a different developer. I've been asked to create an application that will ultimely open a word template insert some data in and save it as a word document with a timestamped filename. Problem the code I am currently using either says the...
1
2689
by: Steve | last post by:
I am trying to figure out how I can center and size a word application active window within my vb.net form when the word document is open using automation so that the word window doesn't extend beyond/overlap the form window (top, left, width or top). Thanks Steve
2
5148
by: Steve | last post by:
I'm using the following code to make a copy of the active word document after mailmerge has occurred. It copies and pastes the contents of the active document into a new document, saves the new document to disk and then deletes the new document. WordApp.Selection.WholeStory() WordApp.Selection.Copy() Dim newDoc As New Word.Document newDoc.Activate() WordApp.Selection.Paste()
0
1128
by: apondu | last post by:
Hi, can someone help me and provide me the information on how to supress the default action of the shortcut keys of word during word automation. I am using C#.Net I have written a code but it generates a exception "Object Reference not set
0
9825
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9671
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10558
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10600
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10257
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7794
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5829
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.