|
-
Sep 9th, 2004, 03:57 PM
#1
Thread Starter
Fanatic Member
Visio and VB6
does any one know if it is possible to connect to Visio with VB6?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 9th, 2004, 04:12 PM
#2
A) To do what?
B) Which version of Visio? (there are two major ones)
-
Sep 9th, 2004, 04:13 PM
#3
Yes, add the reference to your vb project, create an instance of visio
and do some automation etc.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 9th, 2004, 04:19 PM
#4
Here is one way of doing it:
set references to Visio xxxx Type Library and run this sample code:
VB Code:
Private Sub Command1_Click()
Dim vso As Visio.Application
Set vso = New Visio.Application
vso.Documents.Open "c:\temp\Test.vsd"
vso.Visible = True
Set vso = Nothing
End Sub
-
Sep 9th, 2004, 04:22 PM
#5
Rob,
I didn't mean to cross post.
-
Sep 9th, 2004, 04:31 PM
#6
No prob. Don't hear that too often.
Thanks!
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 9th, 2004, 04:36 PM
#7
I found one of my old projects on Visio. It shows how to set the
document properties through code as well as a few other things.
VB Code:
Option Explicit
Dim VS As Visio.Application
Dim VSD As Visio.Document
Dim lPID As Long
Private Sub cmdExit_Click()
frmMain.Visible = False
If TypeName(VS) <> "Nothing" Then
If VS.Visible = True Then
VS.Quit
End If
End If
Set VS = Nothing
Set VSD = Nothing
Unload Me
End Sub
Private Sub cmdRun_Click()
Set VS = New Visio.Application
VS.Visible = True
lPID = VS.ProcessID
Set VSD = VS.Documents.Add(App.Path & "\VB.vst")
VSD.Creator = "RobDog888"
VSD.Company = "RobDog888"
VSD.Title = "VB Visio Automation"
VSD.Description = "Visual Basic automation of Microsoft Visio 2002"
VSD.PrintLandscape = -1
VSD.Application.ActiveDocument.Pages(1) = "VB Visio-1"
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 10th, 2004, 07:39 AM
#8
Thread Starter
Fanatic Member
ok so it is possible to connect to Visio and make a VB6 application. this is what i am trying to do, i need to know if it is possible to make a VB6 application that will access a Visio file and it will look for certain drawing numbers and put them into the visio file, but it has to be done through VB6.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 10th, 2004, 07:46 AM
#9
Thread Starter
Fanatic Member
i was looking in my references and i don't see the Visio library. if i don't have it do you know where i can get it?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 10th, 2004, 08:37 AM
#10
It has to be installed on your development machine at least.
Although, I would check EULA for VISIO runtime files distribution procedure.
-
Sep 10th, 2004, 08:59 AM
#11
PowerPoster
Originally posted by RhinoBull
It has to be installed on your development machine at least.
Although, I would check EULA for VISIO runtime files distribution procedure.
There are no redistributable visio runtimes. If you create an application that automates Visio, then the user's machine will have to have a licensed copy of Visio installed on it. There is no legal way around this ...
That said, I think that Microsoft might have some special integration licensing programs available for Visio, but I am almost certain that they wont be run time royalty free ... and I am certain that the standard Visio EULA has no provisions that allow redistribution.
-
Sep 10th, 2004, 09:01 AM
#12
PowerPoster
Originally posted by Dubya007
ok so it is possible to connect to Visio and make a VB6 application. this is what i am trying to do, i need to know if it is possible to make a VB6 application that will access a Visio file and it will look for certain drawing numbers and put them into the visio file, but it has to be done through VB6.
This is all very much do-able. Take a stab at it and post the Visio and VB6 file and I can try to help if you want ...
-
Sep 10th, 2004, 09:23 AM
#13
Thread Starter
Fanatic Member
ok thanx all. Muddy i will maybe have some thing some time later, just researching the possibilities right now.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 10th, 2004, 10:33 AM
#14
Originally posted by Dubya007
...make a VB6 application that will access a Visio file and it will look
for certain drawing numbers and put them into the visio file, but
it has to be done through VB6.
Look at my code, it opens a drawing and
changes the page name. Instead of changing the name you could
check if it matches the page name in question and go from there.
Is that what you need?
VB Code:
VSD.Application.ActiveDocument.Pages(1) = "VB Visio-1"
'Change to something like this...
If VSD.Application.ActiveDocument.Pages(1) = "TheDrawingNameIamLookingFor" Then
'Do something
Else
'Do domething else
Endif
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 10th, 2004, 10:51 AM
#15
Thread Starter
Fanatic Member
kinda, i need to have a bunch of drawings on an sql server(is that possible?) and then be able to input a part number and it will bring up the drawings and put them all into a visio template.
but that all depends on if you can put a picture on an SQL server.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 11th, 2004, 08:03 AM
#16
Yes, you can put a picture in a field of a record in SQL Server. I havent
done it, but I know its been asked here before. Try a search.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 11th, 2004, 08:37 AM
#17
PowerPoster
Originally posted by RobDog888
Yes, you can put a picture in a field of a record in SQL Server. I havent
done it, but I know its been asked here before. Try a search.
Beacon has a good tutorial regarding this. Download the attachment on the first post of the following thread:
http://www.vbforums.com/showthread.p...threadid=81916
For some reason, storing pictures in a database seems to be a controversial subject. I've seen a few heated threads making arguments against it, but I've never seen a good argument brought against the concept IMHO. I say go for it if it makes sense to you ... :-)
-
Sep 11th, 2004, 10:48 AM
#18
Muddy, I have seen those arguments also. They mainly center
around placing pictures in an Access database and not a SQL
Server. Access can do it but it is not scalable for many pictures.
Also if Access gets corrupt then you loose you pictures. SQL
Server does not get corrupt.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 13th, 2004, 11:24 AM
#19
Thread Starter
Fanatic Member
i am at work and can not follow the link, so is there any way that you could show me the whole address of the link, i tried to copy and paste it but it doesn't work?
Robdogg you seem to know a lot about this stuff, is there a specific format i.e. jpg, tif, gif, bmp, that is better to be stored on an SQL server?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 13th, 2004, 11:29 AM
#20
I would think the better format would be jpg or jpeg.
Code:
http://www.vbforums.com/showthread.php?s=&threadid=81916
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 13th, 2004, 12:10 PM
#21
Thread Starter
Fanatic Member
ok so now i can load a picture on to the SQL server how do i load the images into a picture box?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 13th, 2004, 12:28 PM
#22
PowerPoster
Originally posted by Dubya007
ok so now i can load a picture on to the SQL server how do i load the images into a picture box?
Doesnt Beacon's tutorial example do that too?
-
Sep 13th, 2004, 12:44 PM
#23
Thread Starter
Fanatic Member
Beacons tutorial example doesn't show how to load pictures into the SQL Server. i found how to do load it into the SQL server some some place else. but it seems to be the same. here is the code.
VB Code:
Private Sub Command1_Click()
Dim mystream As ADODB.Stream
Set mystream = New ADODB.Stream
mystream.Type = adTypeBinary
mystream.Open
mystream.LoadFromFile "H:\SAMDrawing\MountingW2Nameplates.bmp"
With Rs
.AddNew
!ArresterNumber = Text1.Text
!Drawing = mystream.Read
.Update
End With
MsgBox "UPDATED AND WORKED"
mystream.Close
Set mystream = Nothing
End Sub
that is how i have found to save a picture to an SQL server. the only problem is now i donno how to load the picture that is saved there to a an image box, or picture box in VB6. any ideas?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 20th, 2004, 08:53 AM
#24
Thread Starter
Fanatic Member
ok i have the part done where i can save/retrieve images from the SQL server and i am working on the VB6 part to open Visio, i just need to be able to put the drawings in specific places in the Visio file. is it possible to put like a "Bookmark" into Visio?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 20th, 2004, 10:43 AM
#25
I believe there is a way to position them, but not sure about bookmarks.
Let me look into it.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2004, 11:42 AM
#26
Thread Starter
Fanatic Member
ok i will look into it as well. i think that it has to do with the different positions from the margins, i saw some thing to that effect in the help files.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 20th, 2004, 12:32 PM
#27
How about using the .Drop method?
VB Code:
Example for Drop, Group
'This Microsoft Visual Basic for Applications (VBA) macro
'demonstrates dropping shapes using the Page, Document,
'and Shape objects.
Public Sub Drop_Example ()
Dim shp1Obj As Visio.Shape
Dim shp2Obj As Visio.Shape
Dim shp3Obj As Visio.Shape
Dim mstObj As Visio.Master
Set shp1Obj = ActivePage.DrawRectangle(1, 2, 2, 1)
Set shp2Obj = ActivePage.DrawRectangle(1, 4, 2, 3)
'Example of Page.Drop
ActivePage.Drop shp1Obj, 3.5, 3.5
Set shp3Obj = ActivePage.Shapes(3)
'Example of Document.Drop - Creates a master
Set mstObj = ActiveDocument.Drop(shp3Obj, 0, 0)
'Example of Shape.Drop
ActiveWindow.DeselectAll
ActiveWindow.Select shp1Obj, visSelect
ActiveWindow.Select shp2Obj, visSelect
ActiveWindow.Group
Set shp1Obj = ActivePage.Shapes(2)
shp1Obj.Drop shp3Obj, 3, 3
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2004, 12:35 PM
#28
Or the .Import method looks good too.
Import method
Example
Imports a file into the application.
Version added: 3.0
Syntax:
objRet = object.Import(fileName)
objRet
A Shape object that represents the new shape imported from the file.
object
Required. An expression that returns the Page, Master, or Shape
object to receive the new shape.
fileName
Required String. The name of the file to import; must be a fully
qualified path.
Remarks:
The Import method imports the file specified by fileName onto a
page, or into a master or group.
The file extension indicates which import filter to use. If the filter
is not installed, the Import method returns an error. The Import
method uses the default preference settings for the specified
filter and does not prompt the user for non-default arguments.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2004, 12:50 PM
#29
Or even use the .PasteSpecial method.
PasteSpecial method
Inserts the contents of the Clipboard, allowing you to control the
format of the pasted information and (optionally) establish a link
to the source file (for example, a Microsoft Word document).
Version added: 2002
Syntax
object.PasteSpecial (format [,link][,displayAsIcon])
object
Required. An expression that returns a Master, Page, or Shape object.
format
Required Long. The internal Clipboard format.
link
Optional Variant. True to establish a link to the source of the
pasted data; otherwise, False (the default). Ignored if the source
data is not suitable for, or doesn't support, linking.
displayAsIcon
Optional Variant. True to display the pasted data as an icon;
otherwise, False (the default).
Remarks
To simply paste the contents of the Clipboard into an object, use
the Paste method.
The PasteSpecial method of a Shape object works only with
Shape objects that are group shapes. Use the Type property of a
shape to determine whether it is a group.
The value of the format argument can be any of the following:
A value from VisPasteSpecialFormat (see the following table).
Any of the standard Clipboard formats, for example, CF_TEXT. For
details, see the Microsoft Platform SDK on the Microsoft Developer
Network (MSDN) Web site.
Any value returned from a call to the RegisterClipboardFormat
function. For details, see the Microsoft Platform SDK on the MSDN
Web site.
Possible values for format declared by the Visio type library in
VisPasteSpecialFormat are described in the following table.
Flag
Value
visPasteText
1
visPasteBitmap
2
visPasteMetafilePicture
3
visPasteOEMText
7
visPasteDeviceIndependentBitmap
8
visPasteEnhancedMetafile
14
visPasteOleObject
65536
visPasteRTF
65537
visPasteHyperlink
65538
visPasteURL
65539
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2004, 01:24 PM
#30
Thread Starter
Fanatic Member
so if a am using ADO to copy files to the c:\temp file then shouldn't i just load those pictures into the Visio Document?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 20th, 2004, 01:43 PM
#31
Yes, the .Import method looks best. You can get the Shape reference
after you import one so you can make adjustments to it or ???
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2004, 01:58 PM
#32
Thread Starter
Fanatic Member
ok so i would put this code in the VB6 code window right?
VB Code:
'Fname is a variable for the string of the location of a file
Dim shp1Obj As Visio.Shape
Set shp1Obj = ActivePage.Import(FName)
i think that is what i need correct?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 20th, 2004, 02:02 PM
#33
Looks right. Does it work for you though?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2004, 02:16 PM
#34
Thread Starter
Fanatic Member
no sir. here is my code
VB Code:
Private Sub cmdVisio_Click()
Dim vso As Visio.Application
Dim shp1Obj As Visio.Shape
Set vso = New Visio.Application
vso.Documents.Open "H:\SAMDrawing\SAMDraw\Test.vsd"
vso.Visible = True
Set shp1Obj = shp1Obj.Import(FName)
Set vso = Nothing
End Sub
this is the error
object variable or with block not set
and it point to this line
Set shp1Obj = shp1Obj.Import(FName)
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 20th, 2004, 02:40 PM
#35
Ok, here is whats going on. You need to add the "shp1Obj" to
the drawing first to create an instance of a Shape object. Then
after its set you can modify its properties. Let me see if I can get
it to work.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 20th, 2004, 03:09 PM
#36
Ok here it is.
VB Code:
Private Sub cmdRun_Click()
Dim vso As Visio.Application
Dim vsd As Visio.Document
Dim vsp As Visio.Page
Dim shp1Obj As Visio.Shape
Set vso = New Visio.Application
Set vsd = vso.Documents.Open("H:\SAMDrawing\SAMDraw\Test.vsd")
vso.Visible = True
Set vsp = vsd.Pages.Item(1)
'Change to reflect the path to a image on your system
Set shp1Obj = vsp.Import("D:\Development\work03.gif")
shp1Obj.CenterDrawing
End Sub
VB/Outlook Guru!
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 21st, 2004, 06:53 AM
#37
Thread Starter
Fanatic Member
why would it tell me that i need to specify the type of file i am importing?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 21st, 2004, 06:56 AM
#38
Thread Starter
Fanatic Member
what references did you add to your project?
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
-
Sep 21st, 2004, 11:02 AM
#39
I added the reference: "Microsoft Visio 2002 Type Library (Service Release 1)"
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 21st, 2004, 11:34 AM
#40
Thread Starter
Fanatic Member
ok i have the right reference. i get an error now that says visio can't open the file for reading.
Last edited by Dubya007; Sep 21st, 2004 at 11:40 AM.
"...Men will still say THIS was our finest hour"
If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|