VB to set image setting

Hi.

Is it possible to create a routine to import a image from the dialog, that 
will:

change the dimensions (x pos, y pos, image width, image height)
Set layer.

    Dim UndoScopeID1 As Long
    UndoScopeID1 = Application.BeginUndoScope("Size & Position 2-D")
    Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
visRowXFormOut, visXFormPinX).FormulaU = "421 mm"
    Application.EndUndoScope UndoScopeID1, True

    Dim UndoScopeID2 As Long
    UndoScopeID2 = Application.BeginUndoScope("Size & Position 2-D")
    Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
visRowXFormOut, visXFormPinY).FormulaU = "618 mm"
    Application.EndUndoScope UndoScopeID2, True

    Dim UndoScopeID3 As Long
    UndoScopeID3 = Application.BeginUndoScope("Size & Position 2-D")
    Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
visRowXFormOut, visXFormWidth).FormulaU = "546 mm"
    Application.EndUndoScope UndoScopeID3, True

    Dim UndoScopeID4 As Long
    UndoScopeID4 = Application.BeginUndoScope("Size & Position 2-D")
    Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
visRowXFormOut, visXFormHeight).FormulaU = "1092 mm"
    Application.EndUndoScope UndoScopeID4, True

    Dim UndoScopeID5 As Long
    UndoScopeID5 = Application.BeginUndoScope("Layer")
    Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
visRowLayerMem, visLayerMember).FormulaForceU = """2"""
    Application.EndUndoScope UndoScopeID5, True


I created a macro but am unfamiliar to the syntax (I am however familiar 
with Excel vba)

I thought it would be more efficient to use a with selection do this.... as 
in Excel, is it not possible to use a layer rather than a number?



Thanks,
 

0
euser (10)
1/9/2009 3:19:31 PM
visio 3638 articles. 1 followers. Follow

2 Replies
1285 Views

Similar Articles

[PageSpeed] 43

"Excel User" <euser@microsoft.com> wrote in message 
news:OTzUB3mcJHA.5788@TK2MSFTNGP03.phx.gbl...
> Hi.
>
> Is it possible to create a routine to import a image from the dialog, that 
> will:
>
> change the dimensions (x pos, y pos, image width, image height)
> Set layer.
>
>    Dim UndoScopeID1 As Long
>    UndoScopeID1 = Application.BeginUndoScope("Size & Position 2-D")
> 
> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
> visRowXFormOut, visXFormPinX).FormulaU = "421 mm"
>    Application.EndUndoScope UndoScopeID1, True
>
>    Dim UndoScopeID2 As Long
>    UndoScopeID2 = Application.BeginUndoScope("Size & Position 2-D")
> 
> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
> visRowXFormOut, visXFormPinY).FormulaU = "618 mm"
>    Application.EndUndoScope UndoScopeID2, True
>
>    Dim UndoScopeID3 As Long
>    UndoScopeID3 = Application.BeginUndoScope("Size & Position 2-D")
> 
> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
> visRowXFormOut, visXFormWidth).FormulaU = "546 mm"
>    Application.EndUndoScope UndoScopeID3, True
>
>    Dim UndoScopeID4 As Long
>    UndoScopeID4 = Application.BeginUndoScope("Size & Position 2-D")
> 
> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
> visRowXFormOut, visXFormHeight).FormulaU = "1092 mm"
>    Application.EndUndoScope UndoScopeID4, True
>
>    Dim UndoScopeID5 As Long
>    UndoScopeID5 = Application.BeginUndoScope("Layer")
> 
> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
> visRowLayerMem, visLayerMember).FormulaForceU = """2"""
>    Application.EndUndoScope UndoScopeID5, True
>
>
> I created a macro but am unfamiliar to the syntax (I am however familiar 
> with Excel vba)
>
> I thought it would be more efficient to use a with selection do this.... 
> as in Excel, is it not possible to use a layer rather than a number?
>
>
>
> Thanks,

Some quick lessons on Visio macro recorded VBA
1) Remove any line referring to UndoScope*
2)  Replace Application.ActiveWindow.Page.Shapes.ItemFromID(12) with a 
reference to a variable of type Visio.shape
3) ItemFromId is not necessary
4) You also need to find a way to properly reference the picture

dim VisShp as Visio.shape
Set VisShp = Application.ActiveWindow.Page.Shapes(12)

VisShp.CellsSRC(visSectionObject, visRowXFormOut, visXFormPinX).FormulaU = 
"421 mm"
 VisShp.CellsSRC(visSectionObject, visRowXFormOut, visXFormPinY).FormulaU = 
"618 mm"
VisShp.CellsSRC(visSectionObject, visRowXFormOut, visXFormWidth).FormulaU = 
"546 mm"
VisShp.CellsSRC(visSectionObject, visRowXFormOut, visXFormHeight).FormulaU = 
"1092 mm"
VisShp (12).CellsSRC(visSectionObject, visRowLayerMem, 
visLayerMember).FormulaForceU = """2"""

John... Visio MVP 

0
lancucki (505)
1/9/2009 5:21:14 PM
John,

Is it not possible to use a selected object, in Excel use can use the 'with 
selection' also is there no way to refer to a specific layer i.e. layer 
named 'plan' rather than a number ?

Thanks,




"John... Visio MVP" <lancucki@stonehenge.ca> wrote in message 
news:OJCGw6ncJHA.5540@TK2MSFTNGP05.phx.gbl...
> "Excel User" <euser@microsoft.com> wrote in message 
> news:OTzUB3mcJHA.5788@TK2MSFTNGP03.phx.gbl...
>> Hi.
>>
>> Is it possible to create a routine to import a image from the dialog, 
>> that will:
>>
>> change the dimensions (x pos, y pos, image width, image height)
>> Set layer.
>>
>>    Dim UndoScopeID1 As Long
>>    UndoScopeID1 = Application.BeginUndoScope("Size & Position 2-D")
>>
>> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
>> visRowXFormOut, visXFormPinX).FormulaU = "421 mm"
>>    Application.EndUndoScope UndoScopeID1, True
>>
>>    Dim UndoScopeID2 As Long
>>    UndoScopeID2 = Application.BeginUndoScope("Size & Position 2-D")
>>
>> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
>> visRowXFormOut, visXFormPinY).FormulaU = "618 mm"
>>    Application.EndUndoScope UndoScopeID2, True
>>
>>    Dim UndoScopeID3 As Long
>>    UndoScopeID3 = Application.BeginUndoScope("Size & Position 2-D")
>>
>> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
>> visRowXFormOut, visXFormWidth).FormulaU = "546 mm"
>>    Application.EndUndoScope UndoScopeID3, True
>>
>>    Dim UndoScopeID4 As Long
>>    UndoScopeID4 = Application.BeginUndoScope("Size & Position 2-D")
>>
>> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
>> visRowXFormOut, visXFormHeight).FormulaU = "1092 mm"
>>    Application.EndUndoScope UndoScopeID4, True
>>
>>    Dim UndoScopeID5 As Long
>>    UndoScopeID5 = Application.BeginUndoScope("Layer")
>>
>> Application.ActiveWindow.Page.Shapes.ItemFromID(12).CellsSRC(visSectionObject, 
>> visRowLayerMem, visLayerMember).FormulaForceU = """2"""
>>    Application.EndUndoScope UndoScopeID5, True
>>
>>
>> I created a macro but am unfamiliar to the syntax (I am however familiar 
>> with Excel vba)
>>
>> I thought it would be more efficient to use a with selection do this.... 
>> as in Excel, is it not possible to use a layer rather than a number?
>>
>>
>>
>> Thanks,
>
> Some quick lessons on Visio macro recorded VBA
> 1) Remove any line referring to UndoScope*
> 2)  Replace Application.ActiveWindow.Page.Shapes.ItemFromID(12) with a 
> reference to a variable of type Visio.shape
> 3) ItemFromId is not necessary
> 4) You also need to find a way to properly reference the picture
>
> dim VisShp as Visio.shape
> Set VisShp = Application.ActiveWindow.Page.Shapes(12)
>
> VisShp.CellsSRC(visSectionObject, visRowXFormOut, visXFormPinX).FormulaU = 
> "421 mm"
> VisShp.CellsSRC(visSectionObject, visRowXFormOut, visXFormPinY).FormulaU = 
> "618 mm"
> VisShp.CellsSRC(visSectionObject, visRowXFormOut, visXFormWidth).FormulaU 
> = "546 mm"
> VisShp.CellsSRC(visSectionObject, visRowXFormOut, visXFormHeight).FormulaU 
> = "1092 mm"
> VisShp (12).CellsSRC(visSectionObject, visRowLayerMem, 
> visLayerMember).FormulaForceU = """2"""
>
> John... Visio MVP 

0
euser (10)
1/10/2009 5:15:44 PM
Reply:

Similar Artilces:

How To Set The Default Fields Displayed
I use lots of folders and sub-folders. I create 2 or 3 or more every week. How do I set the default fields displayed? I have only found that right-clicking on the bar and removing columns I don't want, then right-clicking again and selecting 'Field Chooser" allows me to make this as I want. Can't I just go to a place and say for every new folder, here are the fields I want displayed? See http://www.outlook-tips.net/howto/grouping.htm for the method to use. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exch...

Outlook XP: How to delete Settings
Hello Newsgroup, I wonder if there is an easy way to delete all Outlook settings. Of course I can delete the outlook profile in the control panel, the signatures stored in the user profile, and the registry settings, but as I have to do it for a large number of machines I'd like to know if there is an easier way. I would like to avoid deleting the whole user profile... Thank you very much, Mathias You can batch it and have it executed at logon. The settings are all in the same locations of all users. Use the variables %USERPROFILE% and %USERNAME% to easily set the locations in you...

Tab Default Setting
Is there a way to change some default settings to ones I prefer? I have Publisher 2003. When I start a new blank document. the tab setting is .5". I'd like to change it to .2". I did change it on one of my documents and when I saved it, it seemed to stay for a while but, something I am doing when editing the document changes ii back to .5". It doesn't happen often so I haven't been able to figure out what I'm doing to cause it to change back. I suspect copying a block of text from another document causes it. -- Bob Miller Bob the TAB settings in Publish...

Setting up two accounts
I want to setup two accounts but also want separate outlook folders so one person can download there files without being mixed into the others account. I am running win2K and outlook 2003. paladin61@comcast.net wrote: > I want to setup two accounts but also want separate > outlook folders so one person can download there files > without being mixed into the others account. I am running > win2K and outlook 2003. Then set up two diferent Windows users. Each one will have their own set of Outlook files. "Gordon" <gordonbp1@yahoo.invalid> wrote in message ...

VB distmon?
Hi I have recently installed Office 2003. A couple of wired things happen in Excel: > Everytime I close the program I get a MS VB error that reads "Compile error in hidden module: Distmon" Every time open the program I get the same error, but the macro it is calling is "autoexecnew" > Since my new installation, I type in an simple function like TRIM and it tells me cannot find project library. any ideas? Thnaks! Alan Alan http://support.microsoft.com/default.aspx?scid=kb;EN-US;q307410 OFF: "Compile Error in Hidden Module" Error Message When You Sta...

View settings in word
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Somehow my view settings got messed up. When I pull up a new document, none of the toolbars are there. When I look at the &quot;toolbar settings&quot; under &quot;view&quot;, the toolbars I would like to see are checked, but they are not present. I have to uncheck then re-check them. I even have to go through the process twice with the &quot;standard&quot; toolbar. Is there anyway to re-set default view settings? <br><br>Thanks! Click the little capsule at the right end of the document title ...

Setting Outlook as default for mail and contacts
I have Outlook Express loaded as well as Palm Desktop in addition to Outlook 2000 on my Windows XP computer. I'm trying to get Outlook 2000 to receive all incoming messages and to be the default save for contacts. I've set Outlook as default Internet email in my IE browser, but I still receive all email directed to Outlook Express and all contacts sent as vcf can only be saved in Palm Desktop rather than contacts in Outlook. Any suggestions? Tools/Settings/Control Panel/Internet Options/Apps Remove yr email acconts from Express, or set it not to check for mail on start up. Davi...

how do I set a record keeping template for church records?
I am tring to set a worksheet in Excel to keep track of the offering for our church records. tithes mission and building fund and so on. ...

Excel VB
I have two cells in a workbook that are dates. The cell Start_Date has a valid date in it. The second cell Test_Date is either blank or has a valid date in it. The IsDate test on both cells works fine, however, on a blank cell the Month function extracts "12". Anyone know why? I had to put the month function within a test for IsDate to make it work. Seems like Month function on a blank cell should return something other than a 12. Dave Test code: If IsDate(Range("Start_Date")) Then 'Cell has 11/01/09 in it. MsgBox ("start date a d...

vb from VC++
Hi, is it possible, and if so, to call a Vb macro from VC++. Or manipulate spreadsheets (ie draw graphs from the data within the workbooks) usinbg MFC functions cheers Anthony Presumably you are referring to MS Excel spreadsheets and workbooks. The easiest method would be to import the appropriate type library (.tlb) provided with Excel, having the class wizard generate the classes, which you then use to access the Excel Automation model (that is the same model that Excel VBA uses). Some investigation may be needed to determine which tlb to use, and to make sure you have a basic understand...

SQL to set a supplier
Can someone please help me with the sql to set all the items in a department to one specific supplier? Any help would be appreciated. Craig Craig, are those items currently assigned to any supplier? or they don't have any supplier assigned? -- Ahmed Nashat http://ahmed.nashat.googlepages.com "Craig" <craig@cctropicalparadisepets.com> wrote in message news:CC4E5CE2-36DF-4F28-AC20-A51696529F74@microsoft.com... > Can someone please help me with the sql to set all the items in a > department to one specific supplier? Any help would be appreciated. > Craig...

Object variable or With block variable not set
I'm trying to put a command button on a form using the command button wizard and I am getting this message "Object variable or With block variable not set". I cannot figure out what's happening. I tried opening different instances of Access and am getting the same problem with some but not all of my .mdb files. Hope someone can help. Thanks, Laura Laura Its hard to think what it would be with no example... did you edit the code generated by the wizard? or is it the wizard producing the error? Can you paste the code here? cheers Jeff "laura" <replyto@gr...

how to change the registry settings of another user
Hi, As part of a semi automatic installation and setup of a host I would like to create one administrator account and one ore more (non administrator) user accounts (without passwords) Then I would like to start a script as administrator and change some global and some user specific registry entries. I have problems to modify the settings of another user whle being administrator. The registry entries don't exist). It seems I had to load some 'hive' to be able to access somebody else's registry I did my first tests not with C#, but with python and_winre...

Cannot Add any window to VB
Hello: I'm using a VM with GP 10.0 SP3 installed. In order to have the same as our production databases i copy the GP folder, entirely, which i think it was a mistake now I'm getting a "This cannot be added to Visual Basic", whenever i try to add a window, any window, to VB. Also it goes without saying that there's a lot of load errors starting GP. For the record the copy/paste thing worked, sort of, and before you start thinking that i was insane to have done this, there's a reason behind it, There's been a lot of tweaks to our production server, by our p...

VB in Excel
In Excel I go into Visual Basic Editor, then Visual Basic Help, but when I type 'Passwords' for example it will bring up a list of related items, but some of them you can't select. Does this mean the installation CD is corrupt and hasn't installed all the components? I have reinstalled and repaired the installtion but to no avail. Any ideas anyone? Help! Thanks ...

VB.Net program to create XML file
I need to create an xml file from a VB program using fields returned from an sql query. I have a template that was provided for me and need to use verbatim. Since this is just a text file, I gather that I can just write out the file with all of the tags, etc., and name it .xml. Assuming that is correct what I might want to do is create a template so that if this file changes the names of the elements, all I have to do is change the template and if more elements get added I can then add them. Is there a tool that can do this for me? If I have to create one, any suggestions as to what I ...

VB++ Exe zum Ansprechen einer VB ActiveX DLL
Hallo zusammen. Ich ben�tige eine EXE, welche in einer DOS-Box mit Parametern aufgerufen wird und das Ergebnis auch wieder in dieser DOS-Box zur�ckbringt. Mit VB ist dies leider nicht zu machen. Nun weiss ich zwar das dies mit einer VC++ Exe geht, bin aber leider C Neuling. Kann mir dazu jemand ein Beispiel posten ? Die C++ Exe soll einen auf der Commandozeile �bergebenen String (das sind die ganzen Parameter) an eine Funktion einer VB ActiveX DLL �bergeben. Das Ergebnis soll dann von der ActiveX DLL an die C++ Exe zur�ckgegeben werden und in der selben DOS-Box angezeigt werden. Hoffe es k...

VB Script
Hi all, I need a VB script code to verify whether a specific Local user ID on a remote machine, in workgroup, is having a specific password. For instance I need to check whether target machine consists a local user "DSADMIN" 's password set to "Pa55word". If the target machine consists this user account and the password is also correct then it should return TRUE else it should return FALSE (or something similar). Below code tries to reset the password on target machine by providing same old and new password, if it fails that means the password set on target...

Sumproduct in VB
I want to be able to use the sumproduct function in code to calculate some fairly complex formulas. Within the sumproduct function I'm trying to use a selection critera. The range "Wave" is a named range. This works fine in a regular worksheet function. It multiplies the cells in columns A and B where Wave = 2. =sumproduct(--(Wave=2),$A$1:$A$100,$B$1:$B$10) In VB I have the function below, which surprisingly works just fine as written. For now ignore X... Function mytest(X as Variant, rng1 as Variant, rng2 as Variant) as double mytest = Applicatio...

VB Macro to VB Application
I have a VB macro. I want to move it to a VB application, using my VS 2008. I don't know how to get the Application to run against an Excel Worksheet. Can someone help? Thanks "JCO" <someone@somewhere.com> wrote in message news:%23GDVlhxBLHA.4308@TK2MSFTNGP04.phx.gbl... >I have a VB macro. I want to move it to a VB application, using my VS >2008. If you mean a VBA macro then moving it to VB is usually pretty easy but VS 2008 is not VB, it is VB.Net, and that's a very different language. This group is for VB 6 and earlier versions and doesn...

set focus & screen movement
in Access03 have tabbed page/control about half way in the screen form/detail area. There are 3 tabs and each tab has inset a subform. When one selects a tab, the focus moves to the first control in the subform; but the screen display slides up this control to the detail/header bar ; and thus the info above the tabs, and the tabs themselves no longer display... please no wise cracks about getting a bigger screen !! The work-around is I believe to force a set focus into a control that sits up above the tabs. But the tab Ctl OnClick event will not set focus to any other c...

How can I read NTbackup BKF files using VB .Net pls?
Hello, I want to write a utility to extract files from backups in BKF format created by NTBackup. Does anyone know please if there are any libraries or built-in functions to open BKF files in VB .Net? Thanks, - Alan. Hello, I have the same problem Did you find any solution ? Thanks Pascal frmsrcurl: http://msgroups.net/microsoft.public.dotnet.languages.vb/How-can-I-read-NTbackup-BKF-files-using-VB-Net-pls ...

Retreive emails Using MAPI in VB using Outlook 2003
Till outlook 2000 we had a way to retrieve emails by Reconfiguring Mail Support. Clicking the Corporate or Workgroup option you can download mails from a VB application automatically using MAPI and other Outlook objects without ever opening Outlook. This doesnot happen in Outlook 2003 and there is no option like this to set. Can any one please help me. Thanking you. John Supakin. Hi John, Outlook 2003 is already in "Corporate" mode, and MAPI subsystem is always installed even if you use Pop3/Smtp account only. MAPI spooler is integrated into Outlook 2002 / Outlook 2003 (it...

set pagescale and drawingscale
hi, i'm not sure about the pagescale and drawing scale & how that works. I basically want a page where I can drop a whole lot of box shapes next to each other. The boxes will be from the top of page x = (InternalCounter * 22) y = 360 VisioShapeObject = VisioPageObject.Drop(MasterObject, x, y) X the first time is 0, when i manually place the box next to each other and look at the shapesheet properties, the pinx value is in mulitples of 22. This is exactly what i want but when i generate the code above. The boxes are not next to each other & the pinx value is much less than what i...

setting up a group in contacts
I have one computer that I installed Live mail on and it imported my groups from Outlook express just fine. However in my new computer it will not import my groups with the contacts but wont even give me the option of setting up a new group. Anyone know how to fix this? I'm stumped Groups neither import nor export. In WLMail's Contacts, File | Add A Category. (WLMail's name for groups). -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "elliott" <elliott@discussions.microsoft.com> wrote in message news:39EDAA14-9832-...