Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB to Visio 1

Status
Not open for further replies.

ChiliDog007

Technical User
Sep 20, 2004
24
US
i'm not sure what forum to post this question. but here it is. i have the following code

Private Sub cmdVisio_Click()
Dim shp1Obj As Visio.Shape
Dim shape1 As Visio.Shape
Debug.Print FName
Set VisioApplication = New Visio.Application
Set VisioDocument = VisioApplication.Documents.Open("H:\SAMDrawing\SAMDraw\Test.vsd")
'VisioApplication.Visible = True
Set VisioPage = VisioDocument.Pages.Item(1)
'Change to reflect the path to a image on your system
shape1 = VisioPage.Import("C:\testlogo.bmp")

shp1Obj.CenterDrawing


End Sub
but the problem is that it won't open up the file "C:\testlogo.bmp" it says Visio can't open the file for reading. i have been working on this for 2 days strait. any one know how to load the picture into the visio from vb6?
 
Your code seems to work for me once you use the Set keyword:

Set shape1 = VisioPage.Import("C:\testlogo.bmp")

Try adding the Set keyword first - if you still have problems, check that you have appropriate rights in the directory, and check that the file is not open elsewhere.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
i got it to work thanx very much for the help. do you know any thing about positioning that drawing?
 
You can just set PinX and PinY values (uses drawing values and the Shape's own LocPinX and LocPinY (which default to centre of object)

[tt]
shape1.Cells("PinX").Formula = 3
shape1.Cells("PinY").Formula = 1
[/tt]

Have a look at the Shapesheet for the object for more info on items you can control

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
so is there a way that i can tell where that is going to put my drawing? i have an 11x17'' drawing and i need to put 5 drawings in specific places, how will i know where the drawings are going to go?
 
The Pin position of any Visio object defines its position on the page. The LocPin properties of the object define where that Pin position is relative to the object itself.

In the example above, shape1 will be placed with it's Pin point set at X = 3 and Y = 1 in page dimensions. If your page properties are set to inches, and LocPinX and LocPinY are default (which is at 1/2 width and 1/2 height of the shape) then the centre of the shape will be at 3 inches from the left and 1 inch from the bottom of the page.

You probably need to try the code above and play with it to get the feel of it

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
i did that very thing and now i understand them. many thanx to you for all the help.
 
You're welcome! [smile]

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top