vba - Open field in protected, shared Excel workbook -


i have shared, protected workbook has button bring search form. there 2 fields on form, txtyear , cbxregion, need enabled. whenever try open fields, works until exit excel.

i have tried unprotecting workbook, unsharing it, , commenting out reference in vba reprotecting form. , still, edited vba reverts original.

this section of code referring form need enabled. assistance appreciated. i'm using excel 2010.

private sub userform_initialize()  dim strdb string dim rs adodb.recordset dim cn adodb.connection dim row integer dim accessversionid string  cbxregion.value = worksheets("parameters").cells(5, 14) me.txtyear = worksheets("parameters").cells(4, 7) me.chkboth = worksheets("parameters").cells(9, 2) me.chkconsultant = worksheets("parameters").cells(7, 2) me.chkinhouse = worksheets("parameters").cells(8, 2) 'set region values 'open connection 'select case syscmd(acsyscmdaccessver) 'case 11: accessversionid = "2003" 'end select  'if accessversionid = "2003" '    strdb = worksheets("parameters").cells(17, 2).value 'this reference path 'else     strdb = worksheets("parameters").cells(18, 2).value 'end if  set cn = new adodb.connection cn.open "provider=microsoft.ace.oledb.12.0; data source=" & strdb & ";" set rs = new adodb.recordset  'get recordset rs     set .activeconnection = cn     .open "select * lookupregion"     .requery end  'add regions row = 0 rs     .movefirst     until .eof         cbxregion.additem ![region]         cbxregion.list(row, 1) = ![regionname]         row = row + 1         .movenext     loop end  'close recordset rs.close set rs = nothing cn.close set cn = nothing  end sub 

i managed work. in order, i:

  • unshared workbook
  • unprotected workbook
  • saved, closed, , reopened workbook make sure settings stayed
  • enabled fields
  • saved, closed, , reopened workbook make sure settings stayed
  • protected workbook
  • shared workbook (as required specifications given, rather not share isn't call here)
  • saved, closed, , reopened workbook make sure settings stayed

and works need to.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -