Hi, i need help in creating a macro that will inport file exention which has WK4 , i have lotus notes at work i have exported email file to drive U:\ , i require a macro to pick this file up and export to Sheet Group_Mailbox. The range is A9
I'll try to help you. I've just removed the looping parts of the code you posted, something like this with a bit of tidying up:Ok this is a start, but i need the code to read only one selected file rather than multiple, and also we need to add delimited to the code.
Option Explicit
Sub ConvWk4ToXls()
Dim WK4FilePath As Variant
Dim XLSWorkbook As Workbook
Dim XLSFilePath As String
WK4FilePath = Application.GetOpenFilename(fileFilter:="Pick any wk4 file (*.wk4),*.wk4")
If WK4FilePath <> False Then
Set XLSWorkbook = Workbooks.Open(WK4FilePath, False)
XLSWorkbook.SaveAs XLSWorkbook.Path & "\" & Left(XLSWorkbook.Name, Len(XLSWorkbook.Name) - 4) & ".xls", xlExcel7
XLSFilePath = XLSWorkbook.FullName
XLSWorkbook.Close False
MsgBox WK4FilePath & vbNewLine & "has been converted to Excel format and saved in" & vbNewLine & XLSFilePath
End If
End Sub
I'll try to help you. I've just removed the looping parts of the code you posted, something like this with a bit of tidying up:
What do you mean by "we need to add delimited to the code"?Code:Option Explicit Sub ConvWk4ToXls() Dim WK4FilePath As Variant Dim XLSWorkbook As Workbook Dim XLSFilePath As String WK4FilePath = Application.GetOpenFilename(fileFilter:="Pick any wk4 file (*.wk4),*.wk4") If WK4FilePath <> False Then Set XLSWorkbook = Workbooks.Open(WK4FilePath, False) XLSWorkbook.SaveAs XLSWorkbook.Path & "\" & Left(XLSWorkbook.Name, Len(XLSWorkbook.Name) - 4) & ".xls", xlExcel7 XLSFilePath = XLSWorkbook.FullName XLSWorkbook.Close False MsgBox WK4FilePath & vbNewLine & "has been converted to Excel format and saved in" & vbNewLine & XLSFilePath End If End Sub