Positioning a graph in word is necessary to put the graph in
a page where the description or other supporting details for the graph will be
placed.
But, how to place or put a graph in a specific page in a
document?
By default, the graph will be generated in the first page of
the document.
To position a graph in any page in the document is to create
a bookmark.
If you know exactly where to put the graph, manually create
a bookmark by clicking “Insert” in the
ribbon and selecting “Bookmark”.
After clicking “Bookmark” it will ask for a name and create
any name to define the bookmark.
Once the bookmark has been named and created, you can call
the bookmark via VBA.
Here’s the code to call and select a bookmark:
ActiveDocument.Bookmarks("graph1").Select
graph1 – is the name of the bookmark.
After selecting the bookmark via VBA, call the method to
generate the chart.
Like:
'initialize and set graph type
Set shp = ActiveDocument.Shapes.AddChart(xlXYScatterLines, -18, 80, 480, 380)
Set shp = ActiveDocument.Shapes.AddChart(xlXYScatterLines, -18, 80, 480, 380)
shp.Name =
"Profitchart"
Set cht =
shp.Chart
……… rest of the code follows ..
……… rest of the code follows ..
That’s one way on how to position a graph in a word
document, if there’s another way on how to do it please leave a comment and
share your ideas.
Till next time, cheers!
================================
Free Android Apps:
Click on links below to find out more:
Excel Keyboard shortcuts guide
Linux Android App cheat sheet:
Multiplication Table for early learners
https://play.google.com/store/apps/details?id=com.TableMultiplication
Divine Mercy Chaplet Guide (A Powerful prayer):
Comments
Post a Comment