Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   variable (http://www.outlookbanter.com/outlook-vba/59199-variable.html)

Joel Allen October 18th 07 12:30 AM

variable
 
Hi,

In my custom form code, I have global variable:

Dim varDocumentation

Further down in my code, I add things to the variable like this:

if Item.UserProperties("AirWater") = True then
varDocumentation = varDocumentation & "Air, Water, and Stuctural Reports" &
vbCrLf
end if

if Item.UserProperties("Impact") = True then
varDocumentation = varDocumentation & "Impact Safety Test Report" & vbCrLf
end if

If enough of the my if statements are true, I will get an error saying
"String too long". Any ideas on how to fix this?

Thanks,
Joel



Sue Mosher [MVP-Outlook] October 18th 07 01:14 AM

variable
 
What value does Len(varDocumentation) give you at that point? What's the purpose of that variable?

FYI, the newsgroup for custom form issues is microsoft.public.outlook.program_forms.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Joel Allen" wrote in message ...
Hi,

In my custom form code, I have global variable:

Dim varDocumentation

Further down in my code, I add things to the variable like this:

if Item.UserProperties("AirWater") = True then
varDocumentation = varDocumentation & "Air, Water, and Stuctural Reports" &
vbCrLf
end if

if Item.UserProperties("Impact") = True then
varDocumentation = varDocumentation & "Impact Safety Test Report" & vbCrLf
end if

If enough of the my if statements are true, I will get an error saying
"String too long". Any ideas on how to fix this?

Thanks,
Joel



Joel Allen October 18th 07 02:29 AM

variable
 
Sorry Sue. I figured it out.

"Sue Mosher [MVP-Outlook]" wrote in message
...
What value does Len(varDocumentation) give you at that point? What's the
purpose of that variable?

FYI, the newsgroup for custom form issues is
microsoft.public.outlook.program_forms.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Joel Allen" wrote in message
...
Hi,

In my custom form code, I have global variable:

Dim varDocumentation

Further down in my code, I add things to the variable like this:

if Item.UserProperties("AirWater") = True then
varDocumentation = varDocumentation & "Air, Water, and Stuctural Reports"
&
vbCrLf
end if

if Item.UserProperties("Impact") = True then
varDocumentation = varDocumentation & "Impact Safety Test Report" & vbCrLf
end if

If enough of the my if statements are true, I will get an error saying
"String too long". Any ideas on how to fix this?

Thanks,
Joel





Sue Mosher [MVP-Outlook] October 18th 07 12:35 PM

variable
 
You might want to post your solution, to benefit people who read this thread later and have a similar problem.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Joel Allen" wrote in message ...
Sorry Sue. I figured it out.

"Sue Mosher [MVP-Outlook]" wrote in message
...
What value does Len(varDocumentation) give you at that point? What's the
purpose of that variable?



"Joel Allen" wrote in message
...
Hi,

In my custom form code, I have global variable:

Dim varDocumentation

Further down in my code, I add things to the variable like this:

if Item.UserProperties("AirWater") = True then
varDocumentation = varDocumentation & "Air, Water, and Stuctural Reports"
&
vbCrLf
end if

if Item.UserProperties("Impact") = True then
varDocumentation = varDocumentation & "Impact Safety Test Report" & vbCrLf
end if

If enough of the my if statements are true, I will get an error saying
"String too long". Any ideas on how to fix this?

Thanks,
Joel





Joel Allen October 18th 07 05:31 PM

variable
 
Of course. It's not really a solution, but found a valid work around.

Within a custom form, I had a subroutine that opened a Word document and
populated a Form Field with a large amount of date. It would give me a
string too long error. At first I thought it was the variable within my
custom form. But no, it was the Form field which can only handle so many
characters.

I ended up just making two form fields within Word, and strung them
together.

Joel

"Sue Mosher [MVP-Outlook]" wrote in message
...
You might want to post your solution, to benefit people who read this thread
later and have a similar problem.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Joel Allen" wrote in message
...
Sorry Sue. I figured it out.

"Sue Mosher [MVP-Outlook]" wrote in message
...
What value does Len(varDocumentation) give you at that point? What's the
purpose of that variable?



"Joel Allen" wrote in message
...
Hi,

In my custom form code, I have global variable:

Dim varDocumentation

Further down in my code, I add things to the variable like this:

if Item.UserProperties("AirWater") = True then
varDocumentation = varDocumentation & "Air, Water, and Stuctural Reports"
&
vbCrLf
end if

if Item.UserProperties("Impact") = True then
varDocumentation = varDocumentation & "Impact Safety Test Report" &
vbCrLf
end if

If enough of the my if statements are true, I will get an error saying
"String too long". Any ideas on how to fix this?

Thanks,
Joel







Sue Mosher [MVP-Outlook] October 18th 07 09:11 PM

variable
 
Better yet, don't use a FormField at all. Instead, use a Bookmark and the InsertAfter method to insert your text at that mark.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Joel Allen" wrote in message ...
Of course. It's not really a solution, but found a valid work around.

Within a custom form, I had a subroutine that opened a Word document and
populated a Form Field with a large amount of date. It would give me a
string too long error. At first I thought it was the variable within my
custom form. But no, it was the Form field which can only handle so many
characters.

I ended up just making two form fields within Word, and strung them
together.

Joel

"Sue Mosher [MVP-Outlook]" wrote in message
...
You might want to post your solution, to benefit people who read this thread
later and have a similar problem.



"Joel Allen" wrote in message
...
Sorry Sue. I figured it out.

"Sue Mosher [MVP-Outlook]" wrote in message
...
What value does Len(varDocumentation) give you at that point? What's the
purpose of that variable?



"Joel Allen" wrote in message
...
Hi,

In my custom form code, I have global variable:

Dim varDocumentation

Further down in my code, I add things to the variable like this:

if Item.UserProperties("AirWater") = True then
varDocumentation = varDocumentation & "Air, Water, and Stuctural Reports"
&
vbCrLf
end if

if Item.UserProperties("Impact") = True then
varDocumentation = varDocumentation & "Impact Safety Test Report" &
vbCrLf
end if

If enough of the my if statements are true, I will get an error saying
"String too long". Any ideas on how to fix this?

Thanks,
Joel








All times are GMT +1. The time now is 11:35 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com