spreadsheet simple problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I used a code for locking some Columns , but I having a problem , when I try
to run the form comes the pop up msg saing I was supost to have something in
line 149 that is the "end function" line. the code is this one:
Set pt = XLsheet.ActiveSheet.Protection
XLsheet.Columns(9).Locked = True
XLsheet.Columns(6).Locked = True
For I = 1 to 6
XLsheet.Columns(I).Locked = False
For X = 7 to 8
XLsheet.Columns(X).Locked = False
pt.AllowDeletingColumns = False
pt.AllowDeletingRows = False
pt.AllowFiltering = False
pt.AllowInsertingColumns = False
pt.AllowInsertingRows = False
pt.Enabled = True
End Function
thanks
 
Am Tue, 29 Nov 2005 05:37:03 -0800 schrieb felipe:

Felipe, each For-loop needs to be closed by an Next statement. E.g.

For I = 1 to 6
....
Next
 
that but works Now I had another problem. The thing is that I have two
spreadsheet in my form and I tried to use the code
Dim XLSheet
Dim XlSheet_2
Set oPage = Item.GetInspector.ModifiedFormPages("Mensagem")
Set XLSheet = oPage.Controls("Spreadsheet1")
XLSheet.HTMLData = Item.Body
Set oPage = Item.GetInspector.ModifiedFormPages("Mensagem")
Set XLSheet_2 = oPage.Controls("Spreadsheet2")
XLSheet_2.HTMLData = Item.Body


Function Item_Write()
Item.Body = XLSheet.HTMLData
Item.body = XLSheet_2.HTMLData
End Function


When I used the code only for spreadsheet 1 and erase the code for
spreadsheet2, works perfectly. The other thing that is happening is that I a
button that copies the content from spreadsheet1 to spreadsheet2, Since I put
in the code to protect the spreadsheet this button does not work. Can any one
help
Thanks


"Michael Bauer" escreveu:
 
Am Tue, 29 Nov 2005 09:26:07 -0800 schrieb felipe:

Not sure if I can help because VBS isn´t my area. But it would be very
helpful if you´d tell us what exactly doesn´t work, also, if possible, where
do you get which error.
 
Well now I have my form working almost perfectly. The only thing I can’t do
is sent the the information that I wrote in the spreadsheets of my form. I
used I code to do this when I had only one spreadsheet and the code works
fine, but now I realize I need 2 spreadsheet to complete the task the form
was design for. But when I tried to run the same code (with some name change)
All I get is the info from the second spreadsheet been send and also been
copy to the first one. I need that the unique information from each
spreadsheet is saved and the copy to the right sheet. The code I’m using is
this one.

Dim XLSheet
Dim XlSheet_2
Set oPage = Item.GetInspector.ModifiedFormPages("Mensagem")
Set XLSheet = oPage.Controls("Spreadsheet1")
XLSheet.HTMLData = Item.Body
Set oPage = Item.GetInspector.ModifiedFormPages("Mensagem")
Set XLSheet_2 = oPage.Controls("Spreadsheet2")
XLSheet_2.HTMLData = Item.Body


Function Item_Write()
Item.Body = XLSheet.HTMLData
Item.body = XLSheet_2.HTMLData
End Function


"Michael Bauer" escreveu:
 
Item.Body = XLSheet.HTMLData
Item.body = XLSheet_2.HTMLData

That will overwrite the initial data with the second set of data. If you
want both in Item.Body use this for the second line:

Item.Body = Item.Body & vbCRLF & XLSheet_2.HTMLData

Also, you are instantiating oPage twice as the same thing. Just do it once.

XLSheet.HTMLData = Item.Body
XLSheet_2.HTMLData = Item.Body

will set the data for both sheets to the same data.
 
Your code works, but is not that what I want. I don't want both in the same
item. body. I need two different Item. body so The information in the first
and in the second spreadsheet is save. The information of both of then is
different. It is like that. The first one it is a request of material and the
second one is the confirmation of the material that was bought. I now
understand that I can use “item. Body†just once and if I want to copy the
information in the second spreadsheet I will need to use custom text property
to store the information for the second spreadsheet., but I don’t know which
one to use and how do to so.
English is not my first language, so I’m sorry if my writing is not that clear
Thanks a lot for your attention

"Ken Slovak - [MVP - Outlook]" escreveu:
 
If you want to save the information in the same email you can append the
data from the second sheet to the data from the first one:

' add second data set appended after 2 newlines
Item.Body = Item.Body & vbCRLF & vbCRLF & XLSheet_2.HTMLData

Or you could use Item.UserProperties and add a new UserProperty and add the
data from the second sheet to the new UserProperty.
 
Back
Top