Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Can someone convert this Excel macro code into a VB code to skip use of Excel program ?

Featured Replies

First of all tx in advance for reading this post. I'm not a programmer at all, so I even don't know if I'm asking to do this in the wright coding language:

In essence this my project }:|

I have a .log file that I need to convert structuraly to make it

usefull in FileMaker.

- open the logfile

- In the .log file there is a character that needs to be replaced with

another, to be able to convert it more easely into colums.

- Delete colums the Second and Forth colum (in excel since the shift

places it is first B, than C)

- Then those colums needs to be transposed (rows becomes colums) in order to be able to import them into FileMaker.

- save the logfile

I can do this in Excel but I want to skip the use of Excel. I only like

to use FM because it is going to be a runtime application. My costumers

wont have a 'full version' of FM and may or may not have Excel.

running FM pro 8.5 on Win XP.

Kind regards and Tx in advance !!!!

___________________________________

Option Explicit

Sub ReplaceAndTranspose()

Dim FromChars As Variant

Dim ToChars As Variant

Dim iCtr As Long

FromChars = Array(Chr(28))

ToChars = Array(Chr(124))

If UBound(FromChars) <> UBound(ToChars) Then

MsgBox "design error--make from/to match"

Exit Sub

End If

For iCtr = LBound(FromChars) To UBound(FromChars)

ActiveSheet.Cells.replace What:=FromChars(iCtr), _

Replacement:=ToChars(iCtr), LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False

Next iCtr

Columns("A:A").Select

Selection.TextToColumns Destination:=Range("A1"),

DataType:=xlDelimited, _

TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,

Tab:=False, _

Semicolon:=False, Comma:=False, Space:=False, Other:=True,

OtherChar _

:="|", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1),

Array(4, 1), Array(5, _

1)), TrailingMinusNumbers:=True

Cells.Select

Cells.EntireColumn.AutoFit

Columns("B:B").Select

Selection.Delete Shift:=xlToLeft

Columns("C:C").Select

Selection.Delete Shift:=xlToLeft

Cells.Select

With Selection

.HorizontalAlignment = xlLeft

.VerticalAlignment = xlBottom

.WrapText = False

.Orientation = 0

.AddIndent = False

.IndentLevel = 0

.ShrinkToFit = False

.ReadingOrder = xlContext

.MergeCells = False

End With

Range("A1:B200").Select

Selection.Copy

Sheets.Add

Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,

SkipBlanks:= _

False, Transpose:=True

Application.CutCopyMode = False

ActiveWorkbook.Save

End Sub

I don't think I'm fully understanding what you are asking.

FileMaker can handle an Excel file in several ways:

FileMaker can open an Excel file direct.

FileMaker can import an Excel File into an existing FileMaker File.

Excel can save a file as text which FileMaker can import.

If this doesn't cover it, or you have tried them and it still isn't working, try attaching a copy of the Excel file so we can see the data.

If I have missed your question, please let me know.

HTH

LEe

  • Author

Hello there, tx for replying.

Yes I know that I can import/open an excelfile into FM. And yes I know that excel can convert into a txt file.

This last one is exactly what I do today. I have a log file wich is 'unusable' as it is, open it in excel apply the macro (from my post) and then finally let FM import that modified txt file.

But I read somewhere that minor changes like I do on my log/txt file could maybe be done without the use of excel, just by proper coding in some language.

And that is what I'm looking after }:| cause my clients may or may not have excel on there machines. Modify my log thru coding (which change it into a proper txtfile) which FM can import.

to synthesise : a button with some code behind that does exactly what excel does but without the use excel.

Kind regards

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.