The Code Cage - Microsoft Office help Free Microsoft Office Help for all Applications!
In home Tech Support
Dish Network Deals
 

To stop seeing these ads and get other benefits check This page!

Go Back   The Code Cage Forums > Newsgroups - Microsoft Topics > Newsgroup - Visio Forum > Drawings & Project Plans

Custom Search
Translate this Page!
Chat In Use Now! Microsoft Office Chat Online now!


Drawings & Project Plans Post questions in this forum if they are related to using Microsoft Visio Drawings, Project Plans etc.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 9th February 2010, 03:37 AM
Grind63
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


Anyone familiar with how to edit hyperlinks for multiple shapes by VBA. I
have a series of VSD files that have numerous shapes and pages. Due to soem
changes the code generated hyperlinks created for each shape in these files
is missing a prefix to ensure the file will open a link properly on our
website. For exmaple the current link for one shape is jump.htm?project=1,
and it needs to be revised to ../../../Test/jump.htm?project=1. The only
portion of the hyperlink that is common is the jump.htm, so I am looking for
a VBA code/macr I can run on each file or on a directory of files to revise
every hyperlink for every shape on every file. I have tried several things
with no louck. ANy help would be greatly appreciated. Thanks.
Reply to this post


Did you find this post helpful? Yes | No

The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!
  #2 (permalink)  
Old 9th February 2010, 12:13 PM
AlEdlund
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Re: Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


I'd suggest that you take advantage of the macro recorder while performing
your fixes on the hyperlink section of the shapesheet.
al


"Grind63" <Grind63@discussions.microsoft.com> wrote in message
news:DFBEF091-0C3A-4AE3-9AF7-33791825626D@microsoft.com...
> Anyone familiar with how to edit hyperlinks for multiple shapes by VBA. I
> have a series of VSD files that have numerous shapes and pages. Due to
> soem
> changes the code generated hyperlinks created for each shape in these
> files
> is missing a prefix to ensure the file will open a link properly on our
> website. For exmaple the current link for one shape is
> jump.htm?project=1,
> and it needs to be revised to ../../../Test/jump.htm?project=1. The only
> portion of the hyperlink that is common is the jump.htm, so I am looking
> for
> a VBA code/macr I can run on each file or on a directory of files to
> revise
> every hyperlink for every shape on every file. I have tried several
> things
> with no louck. ANy help would be greatly appreciated. Thanks.


Reply to this post


Did you find this post helpful? Yes | No
  #3 (permalink)  
Old 9th February 2010, 12:13 PM
Paul Herber
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Re: Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


On Mon, 8 Feb 2010 19:25:01 -0800, Grind63 <Grind63@discussions.microsoft.com> wrote:

>Anyone familiar with how to edit hyperlinks for multiple shapes by VBA. I
>have a series of VSD files that have numerous shapes and pages. Due to soem
>changes the code generated hyperlinks created for each shape in these files
>is missing a prefix to ensure the file will open a link properly on our
>website. For exmaple the current link for one shape is jump.htm?project=1,
>and it needs to be revised to ../../../Test/jump.htm?project=1. The only
>portion of the hyperlink that is common is the jump.htm, so I am looking for
>a VBA code/macr I can run on each file or on a directory of files to revise
>every hyperlink for every shape on every file. I have tried several things
>with no louck. ANy help would be greatly appreciated. Thanks.


If it's for every hyperlink then it might be possible to do this:
menu File -> Properties
and set the Hyperlink base to "../../../Test/"


--
Regards, Paul Herber, Sandrila Ltd.
Electronics for Visio http://www.sandrila.co.uk/visio-electronics/
Electrical for Visio http://www.sandrila.co.uk/visio-electrical/
Electronics Packages for Visio http://www.sandrila.co.uk/visio-electronics-packages/
Reply to this post


Did you find this post helpful? Yes | No
The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!
  #4 (permalink)  
Old 9th February 2010, 08:57 PM
Grind63
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Re: Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


AlEdlund,

Tried that, but it does not record correctly and requires the shapes to be
selected oen by one. Was hopign for somethign to loop through each shape and
make the corrections, but I cannot figure out the correct VBA code sequence
to do it. Thanks.

"AlEdlund" wrote:

> I'd suggest that you take advantage of the macro recorder while performing
> your fixes on the hyperlink section of the shapesheet.
> al
>
>
> "Grind63" <Grind63@discussions.microsoft.com> wrote in message
> news:DFBEF091-0C3A-4AE3-9AF7-33791825626D@microsoft.com...
> > Anyone familiar with how to edit hyperlinks for multiple shapes by VBA. I
> > have a series of VSD files that have numerous shapes and pages. Due to
> > soem
> > changes the code generated hyperlinks created for each shape in these
> > files
> > is missing a prefix to ensure the file will open a link properly on our
> > website. For exmaple the current link for one shape is
> > jump.htm?project=1,
> > and it needs to be revised to ../../../Test/jump.htm?project=1. The only
> > portion of the hyperlink that is common is the jump.htm, so I am looking
> > for
> > a VBA code/macr I can run on each file or on a directory of files to
> > revise
> > every hyperlink for every shape on every file. I have tried several
> > things
> > with no louck. ANy help would be greatly appreciated. Thanks.

>

Reply to this post


Did you find this post helpful? Yes | No
  #5 (permalink)  
Old 9th February 2010, 08:58 PM
Grind63
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Re: Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


Paul,

Tried that first thing. It will not accept the string as entered. However,
if I change it in the cell directly it works like a charm. Very frustrating.
Thanks.

"Paul Herber" wrote:

> On Mon, 8 Feb 2010 19:25:01 -0800, Grind63 <Grind63@discussions.microsoft.com> wrote:
>
> >Anyone familiar with how to edit hyperlinks for multiple shapes by VBA. I
> >have a series of VSD files that have numerous shapes and pages. Due to soem
> >changes the code generated hyperlinks created for each shape in these files
> >is missing a prefix to ensure the file will open a link properly on our
> >website. For exmaple the current link for one shape is jump.htm?project=1,
> >and it needs to be revised to ../../../Test/jump.htm?project=1. The only
> >portion of the hyperlink that is common is the jump.htm, so I am looking for
> >a VBA code/macr I can run on each file or on a directory of files to revise
> >every hyperlink for every shape on every file. I have tried several things
> >with no louck. ANy help would be greatly appreciated. Thanks.

>
> If it's for every hyperlink then it might be possible to do this:
> menu File -> Properties
> and set the Hyperlink base to "../../../Test/"
>
>
> --
> Regards, Paul Herber, Sandrila Ltd.
> Electronics for Visio http://www.sandrila.co.uk/visio-electronics/
> Electrical for Visio http://www.sandrila.co.uk/visio-electrical/
> Electronics Packages for Visio http://www.sandrila.co.uk/visio-electronics-packages/
> .
>

Reply to this post


Did you find this post helpful? Yes | No
  #6 (permalink)  
Old 9th February 2010, 10:49 PM
AlEdlund
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Re: Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


So you wrap the hyperlink (shape sheet cell) manipulation with a loop
something like

dim visShape as visio.shape
dim visShapes as visio.shapes
dim visPage as visio.page
set visPage = application.activepage
set visShapes = visPage.Shapes
for each visShape in visShapes
' do the hyperlink cell modification
next visShape

al

"Grind63" <Grind63@discussions.microsoft.com> wrote in message
news:8AD448C0-D140-42F1-A2C9-FA82207D2E25@microsoft.com...
> AlEdlund,
>
> Tried that, but it does not record correctly and requires the shapes to be
> selected oen by one. Was hopign for somethign to loop through each shape
> and
> make the corrections, but I cannot figure out the correct VBA code
> sequence
> to do it. Thanks.
>
> "AlEdlund" wrote:
>
>> I'd suggest that you take advantage of the macro recorder while
>> performing
>> your fixes on the hyperlink section of the shapesheet.
>> al
>>
>>
>> "Grind63" <Grind63@discussions.microsoft.com> wrote in message
>> news:DFBEF091-0C3A-4AE3-9AF7-33791825626D@microsoft.com...
>> > Anyone familiar with how to edit hyperlinks for multiple shapes by VBA.
>> > I
>> > have a series of VSD files that have numerous shapes and pages. Due to
>> > soem
>> > changes the code generated hyperlinks created for each shape in these
>> > files
>> > is missing a prefix to ensure the file will open a link properly on our
>> > website. For exmaple the current link for one shape is
>> > jump.htm?project=1,
>> > and it needs to be revised to ../../../Test/jump.htm?project=1. The
>> > only
>> > portion of the hyperlink that is common is the jump.htm, so I am
>> > looking
>> > for
>> > a VBA code/macr I can run on each file or on a directory of files to
>> > revise
>> > every hyperlink for every shape on every file. I have tried several
>> > things
>> > with no louck. ANy help would be greatly appreciated. Thanks.

>>

Reply to this post


Did you find this post helpful? Yes | No
The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!
  #7 (permalink)  
Old 10th February 2010, 07:52 PM
Grind63
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Re: Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


AlEdlund,

I will give that a try. Thanks.

"AlEdlund" wrote:

> So you wrap the hyperlink (shape sheet cell) manipulation with a loop
> something like
>
> dim visShape as visio.shape
> dim visShapes as visio.shapes
> dim visPage as visio.page
> set visPage = application.activepage
> set visShapes = visPage.Shapes
> for each visShape in visShapes
> ' do the hyperlink cell modification
> next visShape
>
> al
>
> "Grind63" <Grind63@discussions.microsoft.com> wrote in message
> news:8AD448C0-D140-42F1-A2C9-FA82207D2E25@microsoft.com...
> > AlEdlund,
> >
> > Tried that, but it does not record correctly and requires the shapes to be
> > selected oen by one. Was hopign for somethign to loop through each shape
> > and
> > make the corrections, but I cannot figure out the correct VBA code
> > sequence
> > to do it. Thanks.
> >
> > "AlEdlund" wrote:
> >
> >> I'd suggest that you take advantage of the macro recorder while
> >> performing
> >> your fixes on the hyperlink section of the shapesheet.
> >> al
> >>
> >>
> >> "Grind63" <Grind63@discussions.microsoft.com> wrote in message
> >> news:DFBEF091-0C3A-4AE3-9AF7-33791825626D@microsoft.com...
> >> > Anyone familiar with how to edit hyperlinks for multiple shapes by VBA.
> >> > I
> >> > have a series of VSD files that have numerous shapes and pages. Due to
> >> > soem
> >> > changes the code generated hyperlinks created for each shape in these
> >> > files
> >> > is missing a prefix to ensure the file will open a link properly on our
> >> > website. For exmaple the current link for one shape is
> >> > jump.htm?project=1,
> >> > and it needs to be revised to ../../../Test/jump.htm?project=1. The
> >> > only
> >> > portion of the hyperlink that is common is the jump.htm, so I am
> >> > looking
> >> > for
> >> > a VBA code/macr I can run on each file or on a directory of files to
> >> > revise
> >> > every hyperlink for every shape on every file. I have tried several
> >> > things
> >> > with no louck. ANy help would be greatly appreciated. Thanks.
> >>

Reply to this post


Did you find this post helpful? Yes | No
  #8 (permalink)  
Old 12th February 2010, 05:41 PM
Grind63
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Re: Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


AlEdlund,

Okay tried to your suggestion, but I believe the issues I am having is with
how the record macro sets the focus. The following is the portion that
starts the revision of the hyperlink by the record macro method:

Dim vsoHlink1 As Visio.Hyperlink
Set vsoHlink1 =
Application.ActiveWindow.Page.Shapes.ItemFromID(682).Hyperlinks.Item(0)

As you see it is selecting a single shape in the set vsoHlink definition,
which I am not sure how to revise to allow the looping function you sent.
Any suggestions? Thanks.

"AlEdlund" wrote:

> So you wrap the hyperlink (shape sheet cell) manipulation with a loop
> something like
>
> dim visShape as visio.shape
> dim visShapes as visio.shapes
> dim visPage as visio.page
> set visPage = application.activepage
> set visShapes = visPage.Shapes
> for each visShape in visShapes
> ' do the hyperlink cell modification
> next visShape
>
> al
>
> "Grind63" <Grind63@discussions.microsoft.com> wrote in message
> news:8AD448C0-D140-42F1-A2C9-FA82207D2E25@microsoft.com...
> > AlEdlund,
> >
> > Tried that, but it does not record correctly and requires the shapes to be
> > selected oen by one. Was hopign for somethign to loop through each shape
> > and
> > make the corrections, but I cannot figure out the correct VBA code
> > sequence
> > to do it. Thanks.
> >
> > "AlEdlund" wrote:
> >
> >> I'd suggest that you take advantage of the macro recorder while
> >> performing
> >> your fixes on the hyperlink section of the shapesheet.
> >> al
> >>
> >>
> >> "Grind63" <Grind63@discussions.microsoft.com> wrote in message
> >> news:DFBEF091-0C3A-4AE3-9AF7-33791825626D@microsoft.com...
> >> > Anyone familiar with how to edit hyperlinks for multiple shapes by VBA.
> >> > I
> >> > have a series of VSD files that have numerous shapes and pages. Due to
> >> > soem
> >> > changes the code generated hyperlinks created for each shape in these
> >> > files
> >> > is missing a prefix to ensure the file will open a link properly on our
> >> > website. For exmaple the current link for one shape is
> >> > jump.htm?project=1,
> >> > and it needs to be revised to ../../../Test/jump.htm?project=1. The
> >> > only
> >> > portion of the hyperlink that is common is the jump.htm, so I am
> >> > looking
> >> > for
> >> > a VBA code/macr I can run on each file or on a directory of files to
> >> > revise
> >> > every hyperlink for every shape on every file. I have tried several
> >> > things
> >> > with no louck. ANy help would be greatly appreciated. Thanks.
> >>

Reply to this post


Did you find this post helpful? Yes | No
  #9 (permalink)  
Old 12th February 2010, 07:07 PM
SteveM
Newsgroup Contributor


My Top Tip Count:

 
Posts: n/a
Chats:
Default Re: Visio VBA Hyperlinks

------ Register to get rid of these "In Post" ads! ------


On Feb 12, 12:37*pm, Grind63 <Grin...@discussions.microsoft.com>
wrote:
> AlEdlund,
>
> Okay tried to your suggestion, but I believe the issues I am having is with
> how the record macro sets the focus. *The following is the portion that
> starts the revision of the hyperlink by the record macro method:
>
> * * Dim vsoHlink1 As Visio.Hyperlink
> * * Set vsoHlink1 =
> Application.ActiveWindow.Page.Shapes.ItemFromID(682).Hyperlinks.Item(0)
>
> As you see it is selecting a single shape in the set vsoHlink definition,
> which I am not sure how to revise to allow the looping function you sent.*
> Any suggestions? *Thanks.
>
> "AlEdlund" wrote:
> > So you wrap the hyperlink (shape sheet cell) manipulation with a loop
> > something like

>
> > dim visShape as visio.shape
> > dim visShapes as visio.shapes
> > dim visPage as visio.page
> > set visPage = application.activepage
> > set visShapes = visPage.Shapes
> > for each visShape in visShapes
> > * * ' do the hyperlink cell modification
> > next visShape

>
> > al

>
> > "Grind63" <Grin...@discussions.microsoft.com> wrote in message
> >news:8AD448C0-D140-42F1-A2C9-FA82207D2E25@microsoft.com...
> > > AlEdlund,

>
> > > Tried that, but it does not record correctly and requires the shapes to be
> > > selected oen by one. *Was hopign for somethign to loop through eachshape
> > > and
> > > make the corrections, but I cannot figure out the correct VBA code
> > > sequence
> > > to do it. *Thanks.

>
> > > "AlEdlund" wrote:

>
> > >> I'd suggest that you take advantage of the macro recorder while
> > >> performing
> > >> your fixes on the hyperlink section of the shapesheet.
> > >> al

>
> > >> "Grind63" <Grin...@discussions.microsoft.com> wrote in message
> > >>news:DFBEF091-0C3A-4AE3-9AF7-33791825626D@microsoft.com...
> > >> > Anyone familiar with how to edit hyperlinks for multiple shapes byVBA.
> > >> > I
> > >> > have a series of VSD files that have numerous shapes and pages. *Due to
> > >> > soem
> > >> > changes the code generated hyperlinks created for each shape in these
> > >> > files
> > >> > is missing a prefix to ensure the file will open a link properly on our
> > >> > website. *For exmaple the current link for one shape is
> > >> > jump.htm?project=1,
> > >> > and it needs to be revised to ../../../Test/jump.htm?project=1. *The
> > >> > only
> > >> > portion of the hyperlink that is common is the jump.htm, so I am
> > >> > looking
> > >> > for
> > >> > a VBA code/macr I can run on each file or on a directory of files to
> > >> > revise
> > >> > every hyperlink for every shape on every file. *I have tried several
> > >> > things
> > >> > with no louck. *ANy help would be greatly appreciated. *Thanks..


Ya gotta follow Al's code. The For Each loop sets the focus through
all the shapes on the page.

If you want to amend existing hyperlink names, try this:

dim visShape as visio.shape
dim visShapes as visio.shapes
dim visPage as visio.page
dim linkName as Variant
set visPage = application.activepage
set visShapes = visPage.Shapes
for each visShape in visShapes
linkName = visShape.Hyperlinks.Item(0).Address
linkName = "new prefix" & linkName
visShape.Hyperlinks.Item(0).Delete
visShape.Hyperlinks.Add.Address = linkName
next visShape

Above assumes you only have one hyperlink per shape. You also may
have shapes on the page without hyperlinks. In those cases, you have
to insert logic to select the correct link and/or bypass shapes
without links.

SteveM
Reply to this post


Did you find this post helpful? Yes | No
The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!
Reply

Bookmarks

Tags
hyperlinks, vba, visio


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

The Code Cage Affilliates


To stop seeing these ads and get other benefits check This page!



All times are GMT +1. The time now is 01:38 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.5.0
No part of this board may be copied or reproduced either in part or full without the express permission of The Code Cage Team.
We are not associated with nor employed by Microsoft in any way, we simply provide resources!
All MS office icons are registered trademarks of the application the represent