Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am trying to write a macro to export images from multiple graphs based on the user selection.
I have created a button so whenever a user click on the button a set of predefined graphs need to be exported for user selection. These graphs need to be saved on the desired path based on the Selection name. eg. if its an aging graph and the user has selected 'CONNECT' application then the graph needs to be saved as 'Aging_Connect'
I have written the following lines but it seems to throw an error on selection of the value stating that 'Wrong number of arguments or invalid property assignment'. Does not Select statement take string values?
expSelection = ActiveDocument.fields("Application").getSelectedvalues
public sub macro_exportimages()
set expSelection = ActiveDocument.fields("Application").getSelectedvalues
msgbox (expSelection)
select Case expSelection
Case "CONNECT"
ActiveDocument.Sheets("Sheet3").SheetObjects("CH250").ExportBitmapToFile "C:\Users\43862460\Reports\WIP\TestImages\Weekly_Aging_CONNECT.jpg"
Case Else
msgbox "Nothing to export"
End Select
end sub
This example from the API shows how to loop through the selected values in a afield:
set val=ActiveDocument.Fields("Month").GetSelectedValues
for i=0 to val.Count-1
if val.Item(i).IsNumeric then
msgbox(val.Item(i).Number)
else
msgbox(val.Item(i).Text)
end if
next
This example from the API shows how to loop through the selected values in a afield:
set val=ActiveDocument.Fields("Month").GetSelectedValues
for i=0 to val.Count-1
if val.Item(i).IsNumeric then
msgbox(val.Item(i).Number)
else
msgbox(val.Item(i).Text)
end if
next