Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Save macro Truncating text

I have a worksheet that I merged 7 cells wide x 19 cells high. I have
the proprieties set to "Wrap Text". I use this box for a field report.

I am using This Macro to save the worksheet to a new workbook.

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheets\Week Ending " &
Format(Range("h12").Value, "mm-dd-yy Job# ") &
ActiveSheet.Range("h2").Value & " " & Range("b5").Value
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb

ActiveSheet.Shapes("Button 2").Select
Selection.Delete

.SaveAs sFilename
.Close False
End With
End If
End Sub


After I run this macro the new sheet the text in this Field Report Box
is truncated at 255 charaters. Help!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Save macro Truncating text

This happens when you copy a sheet. Just add a command to rewrite the text
in the copied sheet. Assume the upper left corner of your merged cell is
cell B9

Dim wb As Workbook
Dim sh as Wroksheet
set sh = Activesheet
sh.Copy
activesheet.Range("B9").value = sh.Range("B9").Value
Set wb = ActiveWorkbook

--
Regards,
Tom Ogilvy



"Brian" wrote:

I have a worksheet that I merged 7 cells wide x 19 cells high. I have
the proprieties set to "Wrap Text". I use this box for a field report.

I am using This Macro to save the worksheet to a new workbook.

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheets\Week Ending " &
Format(Range("h12").Value, "mm-dd-yy Job# ") &
ActiveSheet.Range("h2").Value & " " & Range("b5").Value
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb

ActiveSheet.Shapes("Button 2").Select
Selection.Delete

.SaveAs sFilename
.Close False
End With
End If
End Sub


After I run this macro the new sheet the text in this Field Report Box
is truncated at 255 charaters. Help!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Save macro Truncating text

That kind of worked. My code is saving the workbook w/ the correct
name and closing the workbook before it rewrites the text. It creates
Book# with the correct text.
New Code:

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
Dim sh As Worksheet
Set sh = ActiveSheet
sh.Copy
ActiveSheet.Range("B25").Value = sh.Range("B25").Value
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheets\Week Ending " &
Format(Range("h12").Value, "mm-dd-yy Job# ") &
ActiveSheet.Range("h2").Value & " " & Range("b5").Value
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb
ActiveSheet.Shapes("Button 2").Select
Selection.Delete


.SaveAs sFilename
.Close False
End With
End If
End Sub


Tom Ogilvy wrote:
This happens when you copy a sheet. Just add a command to rewrite the text
in the copied sheet. Assume the upper left corner of your merged cell is
cell B9

Dim wb As Workbook
Dim sh as Wroksheet
set sh = Activesheet
sh.Copy
activesheet.Range("B9").value = sh.Range("B9").Value
Set wb = ActiveWorkbook

--
Regards,
Tom Ogilvy



"Brian" wrote:

I have a worksheet that I merged 7 cells wide x 19 cells high. I have
the proprieties set to "Wrap Text". I use this box for a field report.

I am using This Macro to save the worksheet to a new workbook.

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheets\Week Ending " &
Format(Range("h12").Value, "mm-dd-yy Job# ") &
ActiveSheet.Range("h2").Value & " " & Range("b5").Value
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb

ActiveSheet.Shapes("Button 2").Select
Selection.Delete

.SaveAs sFilename
.Close False
End With
End If
End Sub


After I run this macro the new sheet the text in this Field Report Box
is truncated at 255 charaters. Help!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Save macro Truncating text

this line isn't necessary:

ActiveSheet.Copy

the sh.copy replaced that. sorry you didn't understand that.

--
Regards,
Tom Ogilvy


"Brian" wrote:

That kind of worked. My code is saving the workbook w/ the correct
name and closing the workbook before it rewrites the text. It creates
Book# with the correct text.
New Code:

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
Dim sh As Worksheet
Set sh = ActiveSheet
sh.Copy
ActiveSheet.Range("B25").Value = sh.Range("B25").Value
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheets\Week Ending " &
Format(Range("h12").Value, "mm-dd-yy Job# ") &
ActiveSheet.Range("h2").Value & " " & Range("b5").Value
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb
ActiveSheet.Shapes("Button 2").Select
Selection.Delete


.SaveAs sFilename
.Close False
End With
End If
End Sub


Tom Ogilvy wrote:
This happens when you copy a sheet. Just add a command to rewrite the text
in the copied sheet. Assume the upper left corner of your merged cell is
cell B9

Dim wb As Workbook
Dim sh as Wroksheet
set sh = Activesheet
sh.Copy
activesheet.Range("B9").value = sh.Range("B9").Value
Set wb = ActiveWorkbook

--
Regards,
Tom Ogilvy



"Brian" wrote:

I have a worksheet that I merged 7 cells wide x 19 cells high. I have
the proprieties set to "Wrap Text". I use this box for a field report.

I am using This Macro to save the worksheet to a new workbook.

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheets\Week Ending " &
Format(Range("h12").Value, "mm-dd-yy Job# ") &
ActiveSheet.Range("h2").Value & " " & Range("b5").Value
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb

ActiveSheet.Shapes("Button 2").Select
Selection.Delete

.SaveAs sFilename
.Close False
End With
End If
End Sub


After I run this macro the new sheet the text in this Field Report Box
is truncated at 255 charaters. Help!




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Save macro Truncating text

Thanks,
It works great now.

Tom Ogilvy wrote:
this line isn't necessary:

ActiveSheet.Copy

the sh.copy replaced that. sorry you didn't understand that.

--
Regards,
Tom Ogilvy


"Brian" wrote:

That kind of worked. My code is saving the workbook w/ the correct
name and closing the workbook before it rewrites the text. It creates
Book# with the correct text.
New Code:

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
Dim sh As Worksheet
Set sh = ActiveSheet
sh.Copy
ActiveSheet.Range("B25").Value = sh.Range("B25").Value
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheets\Week Ending " &
Format(Range("h12").Value, "mm-dd-yy Job# ") &
ActiveSheet.Range("h2").Value & " " & Range("b5").Value
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb
ActiveSheet.Shapes("Button 2").Select
Selection.Delete


.SaveAs sFilename
.Close False
End With
End If
End Sub


Tom Ogilvy wrote:
This happens when you copy a sheet. Just add a command to rewrite the text
in the copied sheet. Assume the upper left corner of your merged cell is
cell B9

Dim wb As Workbook
Dim sh as Wroksheet
set sh = Activesheet
sh.Copy
activesheet.Range("B9").value = sh.Range("B9").Value
Set wb = ActiveWorkbook

--
Regards,
Tom Ogilvy



"Brian" wrote:

I have a worksheet that I merged 7 cells wide x 19 cells high. I have
the proprieties set to "Wrap Text". I use this box for a field report.

I am using This Macro to save the worksheet to a new workbook.

Sub savesheet()


Application.ScreenUpdating = True
Dim wb As Workbook
ActiveSheet.Copy

Set wb = ActiveWorkbook
Application.ScreenUpdating = True
sFilename = "C:\TimeSheets\Week Ending " &
Format(Range("h12").Value, "mm-dd-yy Job# ") &
ActiveSheet.Range("h2").Value & " " & Range("b5").Value
ans = MsgBox("Save file as " & sFilename)

If ans = vbOK Then
With wb

ActiveSheet.Shapes("Button 2").Select
Selection.Delete

.SaveAs sFilename
.Close False
End With
End If
End Sub


After I run this macro the new sheet the text in this Field Report Box
is truncated at 255 charaters. Help!







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
text truncating Overcome by info Excel Discussion (Misc queries) 2 October 1st 07 04:16 PM
truncating text scott_cairns Excel Discussion (Misc queries) 7 May 30th 06 01:51 PM
Truncating a text string bob Excel Worksheet Functions 3 December 20th 05 08:01 PM
Truncating text before a hyphen tcjay Excel Worksheet Functions 1 September 6th 05 12:43 PM
Truncating a text string gavin Excel Discussion (Misc queries) 7 May 11th 05 12:21 AM


All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"