Hi All,
Sorry for that. I am totally new to this.
Hope I've done this code tagging correctly,
Alan
In order to protect my code and data I run the code (pasted below) when my programme starts. It works fine but it has caused me a separate problem.
I have two programmes. One called VatMan (which contains the following code)
The other is FileConvert which copies data into VatMan.
The problem is that VatMan must be open for the FileConvert to work yet when you open VatMan it will not allow itself to be minimised so that another programme can be run.
Do you have any idea what I can do to work around this problem?
Regards,
Alan
CODE WITHIN VatMan
Sub HideAllToolbars()
Dim i As Integer
For i = 1 To Application.Toolbars.Count
Application.Toolbars(i).Visible = False
Next i
' Turn off Toolbar List Shortcuts
CommandBars("Toolbar List").Enabled = False
' Turn off right click
CommandBars(21).Enabled = False
' Turn off alt F11
Application.OnKey "%{F11}", ""
End Sub
CODE WITHIN FILECONVERT
Sub CopyToVatMan()
Dim Var1 As String ‘Used to get destination Workbook
Dim rg1 As Range ‘Data to be copied from Conversion to VatMan
Dim TType As String ‘Tells what Worksheet to be used in VatMan
Dim Pg As String ‘Tells what Worksheet to be used in VatMan
Workbooks("FileConvert.xls").Activate
TType = Sheets("ConversionPage").Cells(2, 1)
If TType = "EXPENSE" Then
Pg = "Expense(Invoices Paid)"
ElseIf TType = "INCOME" Then
Pg = "Income(Invoices Issued)"
ElseIf TType = "EXPORTS" Then
Pg = "Exports"
ElseIf TType = "CAPEX" Then
Pg = "Capital"
ElseIf TType = "NREXPENSE" Then
Pg = "NonRegistered"
Else
MsgBox "There is a problem with your data. Please talk to your IT department before continuing"
GoTo xx
End If
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
FinalCol = Cells(1, Columns.Count).End(xlToLeft).Column
On Error GoTo FileMissing
‘Following line allows user to select name of current VatMan destination file
Var1 = Application.InputBox(prompt:="Enter the name and extention of the VatMan file you wish to update. (e.g. VatManFeb.xls)", Type:=2)
Sheets("ConversionPage").Select
Range("A2:a2").Resize(FinalRow, FinalCol).Copy Destination:=Workbooks(Var1).Worksheets(Pg).Range("A13")
MsgBox "Transfer Complete"
xx:
FileMissing:
MsgBox "The File name entered either can not be found or has not been opened."
End Sub
Bookmarks