Unable to add data to User-Defined Cells

S

Sankalp

Hello,

Am trying to enter data in a shapesheet (user-defined cells) through some
VBA.
I am able to enter the value for the cell - visUserValue, but am NOT able
assign some text to the cell ->visUserPrompt.

*************************
Private Sub Document_DocumentSaved(ByVal doc As IVDocument)
Dim vsoApp As Visio.Application
Dim vsoWnd As Visio.Window
Dim vsoSelection As Visio.Selection
Dim vsoShape As Visio.Shape
Dim vsoSection As Visio.Section
Dim vsoCell As Visio.Cell

Set vsoApp = doc.Application
Set vsoWnd = vsoApp.ActiveWindow
Set vsoSelection = vsoWnd.Selection

Dim nItems As Integer
nItems = vsoSelection.Count

Dim nCnt As Integer
Dim nRow As Integer

If (nItems > 0) Then
Set vsoShape = vsoSelection.Item(1)

If (vsoShape.SectionExists(visSectionUser, True)) Then
Set vsoSection = vsoShape.Section(visSectionUser)
Else
vsoShape.AddSection (visSectionUser)
Set vsoSection = vsoShape.Section(visSectionUser)
End If

nCnt = vsoSection.Count
nRow = vsoShape.AddRow(visSectionUser, visRowUser + nCnt,
visTagDefault)

Set vsoCell = vsoShape.CellsSRC(visSectionUser, (visRowUser + nRow),
visUserPrompt)
vsoCell.Formula = "PD" 'FAILS
'vsoCell.FormulaForce = "PD" 'FAILS
'vsoCell.FormulaForceU = "PD" 'FAILS

Set vsoCell = vsoShape.CellsSRC(visSectionUser, (visRowUser + nRow),
visUserValue)
vsoCell.Formula = "100001"
End If
End Sub
*************************

What I am trying to do is set name-value pairs in these columns and later
read them when needed.
Am I doing anything wrong? Is this the suggested approach to save some user
specific data?

Thanks,
Sankalp
 
J

junethesecond

If you are going to input string into cell,
string must be double quated.
"""PD""" or
Chr(34) & "PD" & Chr(34)
 

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