Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using VBA to place a graphic image on a word document
Message
From
12/02/2000 06:28:25
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
11/02/2000 13:13:09
Bruce Godwin
Williams Babbit & Weisman
Boca Raton, Florida, United States
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00330843
Message ID:
00331295
Views:
30
>has anyone used VBA to place a graphic image on a word document and resize it? I am having trouble figuring out the code.
>
>Is there a good resourse of how to convert the vba macros to fox commands.
>
>I've considered doing it in a visual basic active-x control if necessary, and using the control in fox, but still I don't have a good direction to start.
>
>Any good ideas?
>
>thanks


Here is the sample code I promised :)
lcFileName = "c:\FullPathToFile\FileName.Ext"
oWord = createobject("Word.Application")
With oWord
  .Documents.Add
  With .ActiveDocument
    #Define wdOrientLandscape  1
    #Define wdOrientPortrait  0
    #Define msoFalse 0
    #Define msoTrue -1
    With .PageSetup
      .orientation = wdOrientLandscape && set to Landscape 
* In case you decide not to keep aspect ratio use this      
*      lnPicWidth = .PageWidth - (.LeftMargin + .RightMargin)
      lnPicHeight = .PageHeight - (.TopMargin + .BottomMargin)
    Endwith
* This is valid
*    .InlineShapes.AddPicture(cFileName)
*    with .InlineShapes(1)
* but better you keep a reference to object so you'd be free of indexes
    oMyPic = .InlineShapes.AddPicture(lcFileName)
    With oMyPic
      .Width = lnPicHeight/.Height * .Width
      .Height = lnPicHeight
    Endwith
  Endwith
  .visible = .t.
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform