Access and Visio

N

Naz

Hi

I have a module in an Access database that takes a query, saves it to an
Excel spreadsheet and then runs it through the Organisation chart wizard in
Viso. The code is below and it works really well.
I just want it to do 2 more small things, that sound so simple.
1) I want to select the chart that is made and change the font to size 6.
2) Create a label that simply says Training.
I have highlighted where the lines of code should go....but just can't get
it to work

*************************************
Sub CreateDivOC()


Dim strFilename As String
strFilename = "\\DDFF\Root1\CSS-BSS\SystemFiles\Training\VCharts\Division.xls"

If Len(Dir(strFilename)) > 0 Then
Kill strFilename
End If

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qry_V_Division",
"\\DDFF\Root1\CSS-BSS\SystemFiles\Training\VCharts\Division.xls", False

'Read the command line
Dim strCommand As String
strCommand = Command$

'Check if the add-on exists
'On Error GoTo OrgDoItErrHandler
Dim objVisio As Object
Dim objAddOn As Object

Set objVisio = CreateObject("Visio.Application")
Set objAddOn = objVisio.Addons.ItemU("OrgCWiz")

'Run the add-on (errors are handled by the add-on)
'On Error Resume Next

'Break up the string
Dim strCommandPart As String
Dim strCommandLeft As String
Dim UndoScopeID1 As Long
Dim UndoScopeID2 As Long
strCommandLeft = strCommand

objAddOn.Run ("/S-INIT")
While (Len(strCommandLeft) > 0)
strCommandPart = Left(strCommandLeft, MAX_ARGSTRING_LENGTH)
strCommandLeft = Mid(strCommandLeft, Len(strCommandPart) + 1)
objAddOn.Run ("/S-ARGSTR " + strCommandPart)
Wend
objAddOn.Run ("/S-RUN /filename =
\\LBHF\Root1\CSS-BSS\SystemFiles\Training\VCharts\Division.xls/display-fields
= Name, JobTitle")
objVisio.Application.ActiveWindow.ShowGrid = False
**** Line to make everything size 6
**** Line to make label



Exit Sub

OrgDoItErrHandler:
MsgBox "error"

End Sub
*****************************************

Any help is greatly appreciated.
 
A

Al Edlund

I'd suggest that you use the macro recorder within visio. It will allow you
to perform the actions you want and save them as a macro. You can then use
the macro as a template for what you want to code into access. The only
thing that might be different is that you want to cycle through the shapes on
the page.

dim objPage as visio.page
dim objShape as visio.shape
dim objCell as visio.cell

set objPage = objVisio.activepage
for each objShape in objPage.shapes
' do something with the appropriate shapes cell...
next objshape
 

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