Why my picture disappear after i run my maro with bookmarks?

  • Thread starter teddy beh via OfficeKB.com
  • Start date
T

teddy beh via OfficeKB.com

Hi,

I write a marco to place some text in the bookmark. But my picture locate
in header disappear after that. Any one can guide me?

Thank you.
 
C

Cindy M -WordMVP-

Hi Teddy,
I write a marco to place some text in the bookmark. But my picture locate
in header disappear after that. Any one can guide me?
Not without seeing your macro code. And a more complete description of how
the document is set up (where's the bookmark, etc.)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
T

teddy beh via OfficeKB.com

Thanks for your reply.

My company logo is locate at the header of the template. When the template
is selected the macro will run and allow user to choose company name. After
i click on the ok button, company name, address, postal, tel no and fax no
will display on the specific location at header whereby i'm using bookmark
to control it. But after that my company logo disappear. Company logo i
insert as a picture.
 
C

Cindy M -WordMVP-

Hi Teddy,
My company logo is locate at the header of the template. When the template
is selected the macro will run and allow user to choose company name. After
i click on the ok button, company name, address, postal, tel no and fax no
will display on the specific location at header whereby i'm using bookmark
to control it. But after that my company logo disappear. Company logo i
insert as a picture.
I'd need to see the macro code. And you also need to tell me

1. Is the logo inserted with text wrap formatting, or in-line with the text

2. Where does it stand in relation to the bookmark target for the information
in the macro?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
T

teddy beh via OfficeKB.com

Below is my code:
My company logo stay at the left of the header and company detail stay at the
right of the header.

Private Sub btnOK_Click()
' Code to run when OK button is clicked
'
' Declare variables for this procedure
Dim ProtectType As Integer, i As Integer
Dim ErrMsg As String

' Check for any empty textbox
If (OptionButton1.Value = False) And (OptionButton2.Value = False) And
(OptionButton3.Value = False) And (OptionButton4.Value = False) And
(OptionButton5.Value = False) Then
MsgBox "Please select a Company Name!", , ""
Exit Sub
End If

' Insert the information into the bookmarks
' Call macro below to update bookmarks without deleting them
If (OptionButton1.Value = True) Then
UpdateBookmarkProc "CompanyName", "CompanyName"
UpdateBookmarkProc "RegNo", "RegNo"
UpdateBookmarkProc "Address1", "Address1"
UpdateBookmarkProc "Address2", "Address2"
UpdateBookmarkProc "CountryPostalcode", "CountryPostalcode"
UpdateBookmarkProc "TelNo", "TelNo"
UpdateBookmarkProc "FaxNo", "FaxNo"
UpdateBookmarkProc "URL", "URL"
ElseIf (OptionButton2.Value = True) Then
UpdateBookmarkProc "CompanyName", "CompanyName"
UpdateBookmarkProc "RegNo", "RegNo"
UpdateBookmarkProc "Address1", "Address1"
UpdateBookmarkProc "Address2", "Address2"
UpdateBookmarkProc "CountryPostalcode", "CountryPostalcode"
UpdateBookmarkProc "TelNo", "TelNo"
UpdateBookmarkProc "FaxNo", "FaxNo"
UpdateBookmarkProc "URL", "URL"
ElseIf (OptionButton3.Value = True) Then
UpdateBookmarkProc "CompanyName", "CompanyName"
UpdateBookmarkProc "RegNo", "RegNo"
UpdateBookmarkProc "Address1", "Address1"
UpdateBookmarkProc "Address2", "Address2"
UpdateBookmarkProc "CountryPostalcode", "CountryPostalcode"
UpdateBookmarkProc "TelNo", "TelNo"
UpdateBookmarkProc "FaxNo", "FaxNo"
UpdateBookmarkProc "URL", "URL"
ElseIf (OptionButton4.Value = True) Then
UpdateBookmarkProc "CompanyName", "CompanyName"
UpdateBookmarkProc "RegNo", "RegNo"
UpdateBookmarkProc "Address1", "Address1"
UpdateBookmarkProc "Address2", "Address2"
UpdateBookmarkProc "CountryPostalcode", "CountryPostalcode"
UpdateBookmarkProc "TelNo", "TelNo"
UpdateBookmarkProc "FaxNo", "FaxNo"
UpdateBookmarkProc "URL", "URL"
ElseIf (OptionButton5.Value = True) Then
UpdateBookmarkProc "CompanyName", "CompanyName"
UpdateBookmarkProc "RegNo", "RegNo"
UpdateBookmarkProc "Address1", "Address1"
UpdateBookmarkProc "Address2", "Address2"
UpdateBookmarkProc "CountryPostalcode", "CountryPostalcode"
UpdateBookmarkProc "TelNo", "TelNo"
UpdateBookmarkProc "FaxNo", "FaxNo"
UpdateBookmarkProc "URL", "URL"
Else
UpdateBookmarkProc "CompanyName", "CompanyName"
UpdateBookmarkProc "RegNo", "RegNo"
UpdateBookmarkProc "Address1", "Address1"
UpdateBookmarkProc "Address2", "Address2"
UpdateBookmarkProc "CountryPostalcode", "CountryPostalcode"
UpdateBookmarkProc "TelNo", "TelNo"
UpdateBookmarkProc "FaxNo", "FaxNo"
UpdateBookmarkProc "URL", "URL"
End If

ErrorHandler:
If Err.Number = 5941 Then ' "no such member of collection"
MsgBox "One or more bookmarks are missing from the template", ,
"Error"
End If
Unload Me
End Sub

Private Sub UpdateBookmarkProc(BookmarkToUpdate As String, TextToUse As
String)
Dim BMRange As Range
Set BMRange = ActiveDocument.Bookmarks(BookmarkToUpdate).Range
BMRange.Text = TextToUse
ActiveDocument.Bookmarks.Add BookmarkToUpdate, BMRange
End Sub
 
C

Cindy M -WordMVP-

Hi Teddy,
My company logo stay at the left of the header and company detail stay at the
right of the header.
You missed one key point of information: is the logo inserted in-line with the
text, or with text wrap? I guess I'd also need to ask if the company detail is
going into a textrange, or a textbox, seeing as you seem to be using text
boxes.

Anyway, my best guess would be that your logo has textwrap formatting, and is
anchored to the bookmark range where you're inserting the text. When you insert
text into a bookmark, that range is replaced. It could be you're deleting the
logo's anchor (and therefore the logo) along with that range.

Check where that anchor is located...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top