hi...
how can i save as my dbf file to xls by macro?because i everyday need convert my dbf file to xls by manually..i hope can create like microsoft excel (xlsm)file then can.automatic convert...
dbf to xls file by macro
-
- Posts: 2
- Joined: Mon Apr 02, 2018 2:38 am
dbf to xls file by macro
Last edited by robleyd on Mon Apr 02, 2018 4:03 am, edited 1 time in total.
Reason: Remove Known Issues icon [robleyd, Moderator]
Reason: Remove Known Issues icon [robleyd, Moderator]
openoffice 3.1
-
- Posts: 2
- Joined: Mon Apr 02, 2018 2:38 am
Re: dbf to xls file by macro
Sub auto_open()
Run "excelcopy"
End Sub
Sub excelcopy()
Dim x As Workbook
Dim y As Workbook
'## Open both workbooks first:
Set x = Workbooks.Open("C:\data\itemmas.dbf")
Set y = Workbooks.Open("C:\Users\Dropbox\backup\cs042018.csv")
'Now, copy what you want from x:
x.Sheets("CS042018").Range("A:A,B:B,M:M,O:O").Copy
'Now, paste to y worksheet:
y.Sheets("cs042018").Range("A1").PasteSpecial
y.Save
'Close x:
x.Close
y.Close False
Application.Quit
End Sub
please help me check any wrong of my code?
Run "excelcopy"
End Sub
Sub excelcopy()
Dim x As Workbook
Dim y As Workbook
'## Open both workbooks first:
Set x = Workbooks.Open("C:\data\itemmas.dbf")
Set y = Workbooks.Open("C:\Users\Dropbox\backup\cs042018.csv")
'Now, copy what you want from x:
x.Sheets("CS042018").Range("A:A,B:B,M:M,O:O").Copy
'Now, paste to y worksheet:
y.Sheets("cs042018").Range("A1").PasteSpecial
y.Save
'Close x:
x.Close
y.Close False
Application.Quit
End Sub
please help me check any wrong of my code?
openoffice 3.1
Re: dbf to xls file by macro
What is wrong?! The whole code is wrong, because it is a VBA code. The VBA of the MS Office and the API+StarBasic combo of the AOO/LO are not compatible.please help me check any wrong of my code?
...And you want to convert a file into a foreign, never standardized file format. The AOO/LO works best in the native, International Standard ODF fileformats. (In this case: in .ods.) Use it.
Tips:
- You can try the LibreOffice. It has a littlebit higher compatibility with the foreign file formats, and with the VBA macros.
- Use the "Option VBA support 1" statement at the begin of your code. That "warns" the application to the foreign code elements.
- Rewrite your macro code based on the API function in StarBasic (or in an other supported language). API: Application Programming Interface.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.