Vishal Srivastava
Member
Hi Friends,
I need your help regarding this issue. I am working on a project where I have to export the "Tax Invoice" to a new workbook. I am using following code for exporting the workbook:
Everything works fine except the formatting of the exported book.
In exported workbook, Row height got fit automatically to default excel row size. Fonts got changed from my selected font "Verdana" to default excel font "Calibiri".
I have tried at my best but got no solution to this problem. I just want to export the workbook with the same formats and row height.
Hope You have understood my problem now.
I am also attaching a sample workbook for your reference.
Please help me out.
Thanks & Regards,
CMA Vishal Srivastava
I need your help regarding this issue. I am working on a project where I have to export the "Tax Invoice" to a new workbook. I am using following code for exporting the workbook:
Code:
Sub Export_Invoice()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim iname As Variant
Dim iname2 As Variant
Dim d As Variant
Dim shipid As Integer
Dim shiptext As String
Dim iWords As String
iname = ActiveWorkbook.Name
Workbooks.Add
iname2 = ActiveWorkbook.Name
Windows(iname).Activate
Sheets("Invoice").Select
Cells.Select
Selection.Copy
Windows(iname2).Activate
Columns("A:A").Select
ActiveSheet.Paste
Cells.Select
ActiveSheet.Paste
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveSheet.Columns("L:P").EntireColumn.Hidden = True
For Each d In ActiveSheet.Shapes
If Left(d.Name, 4) = "Drop" Then
d.Delete
End If
Next
ActiveWorkbook.Colors(39) = RGB(234, 234, 234)
Range("A1").Select
ActiveWindow.DisplayGridlines = False
Application.CutCopyMode = False
With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.LeftHeader = ""
.CenterFooter = "Page &8&P of &N"
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.34)
.BottomMargin = Application.InchesToPoints(0.55)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.3)
.CenterHorizontally = False
.Orientation = xlPortrait
End With
MsgBox "This invoice has been exported to a new workbook: " & iname2
Windows(iname).Activate
Range("A1").Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Everything works fine except the formatting of the exported book.
In exported workbook, Row height got fit automatically to default excel row size. Fonts got changed from my selected font "Verdana" to default excel font "Calibiri".
I have tried at my best but got no solution to this problem. I just want to export the workbook with the same formats and row height.
Hope You have understood my problem now.
I am also attaching a sample workbook for your reference.
Please help me out.
Thanks & Regards,
CMA Vishal Srivastava